I've been doing: @Inject private ComponentSource componentSource;
public MyBasePage getPage(String pageName) { return (MyBasePage) componentSource.getPage(pageName); } On Thu, Jul 26, 2012 at 10:12 AM, Christian Riedel <cr.ml...@googlemail.com>wrote: > You could inject the ComponentResources into your component and call > getPage(): > > /** > * Returns the page that contains this component. Technically, the > page itself is an internal object in Tapestry and > * this returns the root component of the actual page, but from an > application developer point of view, this is the > * page. > */ > Component getPage(); > > > Am 26.07.2012 um 10:27 schrieb wout86: > > > Hi, > > > > We all know Tapestry page instances can be obtained by "injecting" them > in a > > variable using its type or its name, e.g., as follows: > > > > @InjectPage private HomePage home; > > > > or > > > > @InjectPage("HomePage") private Object home; > > > > However, this method only allows pages to be injected whose names are > known > > at compile-time. > > > > I was wondering whether there's a way to obtain a page instance through > some > > sort of getter method, such that the page name doesn't have to be known > at > > compile-time? E.g., as follows: > > > > Object home = Global.getPage("HomePage"); > > > > Thanks in advance, and best regards, > > Wouter > > > > > > > > -- > > View this message in context: > http://tapestry.1045711.n5.nabble.com/Is-it-possible-to-obtain-page-instances-programmatically-by-name-tp5714794.html > > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > > For additional commands, e-mail: users-h...@tapestry.apache.org > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >