You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "F. Da Costa Gomez" <da...@gmail.com> on 2005/03/04 18:23:16 UTC

When does pageName get set?

Hi,

Could someone please confirm whether the following is correct?
The initialize() method is called when a page is called (read created for the 
very first time). So if i need do have 'stuff' set on the page before *any* 
rendering or other processing takes place this is where i do it.

Assuming the above is correct the pageName has *not* been set/ derived yet. Now 
for the interesting bit: When *does* the pageName get set?

I'm trying to put together an 'easy' way to auto-generate a 'crumbish' menu 
based on the pages in a package (or should i say directory?). Adding a page 
would imply auto-inclusion. The way i'm currently looking at it i only need to 
put the menu together once and only in the main page (for the dir).

This is why i'm trying to get a hold of the pageName. Hardcoding the pagename 
works fine.

tia,

Fermin DCG


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: When does pageName get set?

Posted by Marcus Brito <mb...@gmail.com>.
> Could someone please confirm whether the following is correct?
> The initialize() method is called when a page is called (read created for the
> very first time). So if i need do have 'stuff' set on the page before *any*
> rendering or other processing takes place this is where i do it.

Not really. Unfortunately, the initialize() method isn't aptly named.
initialize() is a method designed to bring you page back to a "clean"
state, before it is put back in the pool. This is a place to set all
your variables back to null and to free resources, not to do
initialization code. The naming sucks, we know.

Your best option for initialization routines is implementing
org.apache.tapestry.event.PageRenderListener in your Page class, and
perform any task in the pageBeginRender() implementation.

> I'm trying to put together an 'easy' way to auto-generate a 'crumbish' menu
> based on the pages in a package (or should i say directory?). Adding a page
> would imply auto-inclusion. The way i'm currently looking at it i only need to
> put the menu together once and only in the main page (for the dir).

I guess implementing PageRenderListener on all your pages and somehow
recording all page accesses (eg, on the visit object) would solve your
problem. When pageBeginRender() is called you can already obtain the
page name.

-- Marcus Brito <mb...@gmail.com>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org