I'm not sure giving the Tapestry engine the power to guess what objects needs 
injecting is a good idea. What if you specified one of the properties you 
specified below, but wanted to set it manually from pageBeginRender? Or 
inject a ServletContext or WebRequest from a different service location?

I think that the little effort it takes to clearly define exactly what gets 
injected, and avoid potential ambiguities, overrides any need for automagical 
dependecy injection.

regards,
Scott

>
> Lets look at the common stuff:
> @InjectObject("service:tapestry.globals.WebRequest")
> public abstract WebRequest getWebRequest();
>
> @InjectObject("service:tapestry.globals.ServletContext")
> public abstract ServletContext getServletContext();
>
> Is there any ambiguity in what we want to inject? I do
> not think so.
>
> I am pretty sure that having just abstract methods in
> the page/component class should be enough for Tapestry
> to inject necessary objects:
> public abstract WebRequest getWebRequest();
> public abstract ServletContext getServletContext();
>
>
> Any comments Howard?
>
> --- Paolo DonĂ  <[EMAIL PROTECTED]> wrote:
> > I'm writing an xdoclet2 plugin to avoid writing
> > .page and .jwc files.
> > Don't know if that can help... you write xdoclet
> > tags instead of jdk5
> > annotations.
> > go to http://xdoclet.codehaus.org/Tapestry+plugin if
> > interested.
> >
> > Paolo
> >
> > However, this is a repetitive piece of code that I
> > want to avoid.
> >
> > [cut]
> >
> > > However, I can not use JDK 1.5 yet and the only
> >
> > way to do this, as I
> >
> > > understand, is to inject Page Class properties in
> >
> > the page
> >
> > > specification.
> > >
> > > Since I am lazy ;-) and want to avoid this
> >
> > repetitive pieces of XML,
> >
> > [cut]
>
> Konstantin Ignatyev
>
>
>
>
> PS: If this is a typical day on planet earth, humans will add fifteen
> million tons of carbon to the atmosphere, destroy 115 square miles of
> tropical rainforest, create seventy-two miles of desert, eliminate between
> forty to one hundred species, erode seventy-one million tons of topsoil,
> add 2,700 tons of CFCs to the stratosphere, and increase their population
> by 263,000
>
> Bowers, C.A.  The Culture of Denial:  Why the Environmental Movement Needs
> a Strategy for Reforming Universities and Public Schools.  New York:  State
> University of New York Press, 1997: (4) (5) (p.206)

Reply via email to