'best way' ? I can tell you what I think is better... I would suggest that you handle AbstractBasePage -> Layout the same way that you handle Layout -> Heading.
Let me guess - you want every page to have a title... I was thinking of that at one stage. The is a way to get the page class doing the rendering... something like (Object) getPageClass... (then use instanceof)... It can be done in the Header itself... but I cant remember how to get it. ComponentResources getPage looks close... but I don't recall. On Fri, Apr 18, 2008 at 12:20 PM, Blower, Andy <[EMAIL PROTECTED]> wrote: > Add the @Property annotation to dummy in component class to provide > getter+setter? > > > -----Original Message----- > > From: Jan Vissers [mailto:[EMAIL PROTECTED] > > Sent: 18 April 2008 11:59 > > To: nicholas Krul > > Cc: Tapestry users > > Subject: Re: T5: How do I access a page property in my component > > > > This approach doesn't work. > > > > > > Top level class-> > > > > public abstract class AbstractBasePage { > > private int dummy; > > > > public int getDummy() { > > return 14575; //Test > > } > > } > > > > Component class (which is part of Layout) > > @Parameter > > private int dummy; > > > > Component template > > ${dummy} > > > > -> without getter in Component class: error > > -> with getter in Component class: always 0 > > > > Any other ideas - I must be doing some wrong, right? > > > > -J. > > > > > > > > On Fri, 2008-04-18 at 11:43 +0100, nicholas Krul wrote: > > > @Paramater per property required. > > > If you need access to all of them as a bundle, consider wrapping them > > > into a class. > > > > > > > > > > > > > > > ... > > > or (I guess) you could use > > > @Parameter > > > private MyBasePageClass basePage; > > > > > > and make sure that the MyBasePageClass has a getThis(return this;) > > > method > > > > > > bind as <t:myComp t:basePage="this" /> > > > > > > (I think) > > > > > > > > > I'd suggest trying the first... > > > but, at least you have a solution that works. > > > > > > --nK > > > > > > On Fri, Apr 18, 2008 at 11:32 AM, Jan Vissers > > <[EMAIL PROTECTED]> > > > wrote: > > > Ok - figured out what @InjectContainer gives me. > > > Although I'm not quite happy with it, as it returns another > > > component, > > > which contains the component - but not the actual page. This > > > is one > > > level further up the foodchain for me ;-) > > > > > > Would be nice to have a direct way to access page > > > properties :-( > > > > > > -J. > > > > > > > > > On Fri, 2008-04-18 at 12:26 +0200, Jan Vissers wrote: > > > > Thanks - but I don't understand... > > > > > > > > What is the parameter - the containing page? > > > > > > > > Basically I want to access a property from my > > > 'AbstractBasePage' which > > > > has some common properties on it from a component that is > > > placed on a > > > > concrete page. > > > > > > > > @Chris: regarding your hint of @InjectContainer...? what > > > should the type > > > > be - 'Page'? > > > > > > > > -J. > > > > > > > > On Fri, 2008-04-18 at 11:23 +0100, nicholas Krul wrote: > > > > > bind it as a paramater > > > > > > > > > > @Paramater(required=true) //only if required > > > > > Object needed > > > > > > > > > > > > > > > > > > > > On Fri, Apr 18, 2008 at 11:07 AM, Chris Lewis > > > <[EMAIL PROTECTED]> > > > > > wrote: > > > > > > > > > > > Jan, > > > > > > > > > > > > There's probably a simpler way, but you should be able > > > to use > > > > > > @InjectContainer in your component to get the page and > > > call whatever > > > > > > methods (in your case a a getter) you want. I imagine > > > there's a more > > > > > > terse way, but I'm not sure what it would be. > > > > > > > > > > > > chris > > > > > > > > > > > > Jan Vissers wrote: > > > > > > > Hi, > > > > > > > > > > > > > > I want to access a page property from within my > > > component - that has > > > > > > > been placed on that page. In T4 I had something like > > > 'page.' - how is > > > > > > > this done in T5? > > > > > > > > > > > > > > Thx, > > > > > > > -J. > > > > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------------- > > -------- > > > > > > > To unsubscribe, e-mail: > > > [EMAIL PROTECTED] > > > > > > > For additional commands, e-mail: > > > [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > http://thegodcode.net > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------------- > > -------- > > > > > > To unsubscribe, e-mail: > > > [EMAIL PROTECTED] > > > > > > For additional commands, e-mail: > > > [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------------- > > -------- > > > > To unsubscribe, e-mail: > > > [EMAIL PROTECTED] > > > > For additional commands, e-mail: > > > [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > ------------------------------------------------------------- > > -------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: > > > [EMAIL PROTECTED] > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >