I usually use something like this: @Component(parameters = { "page=prop:editEmployeePage", "context=prop: employee.id }) private PageLink pageLink;
@Inject private ComponentClassResolver resolver; @Cached public String getEditEmployeePage() { resolver.resolvePageClassNameToPageName(EditEmployeePage.class); } regards, Onno 2009/6/21 Vjeran Marcinko <vjeran.marci...@email.t-com.hr> > Hello, > > I have an idea for PageLink version that would be type-safe because I > simply love when I don't have to worry about page names or context > parameters in my templates as much as possible, especially cosidering that I > like to refactor much... > > If PageLink could accept page *instance* as parameter, it could resolve > page name and also activation context from this instance. > For example, in ViewAllEmployeesPage class I need to provide > EditEmployeePage instance for each looped employee ID as activation context, > I could have: > > > private Employee employee; // looped employee > > @InjectPage > private EditEmployeePage editEmployeePage; > > public Object getEditEmployeePageInstance() { > editEmployeePage.onActivate(employee.getId()); // configuring page > isntance > return editEmployeePage; > } > > It seemed simple enough to write my own TypeSafePageLink that would render > these links via : > PageRenderLinkSource.createPageRenderLinkWithContext(Class pageClass, > Object... context); > ...but I got in problem how to extract this activation context parameter > from page instance parameter ? > Any Tapestry utility method for this somewhere? > > Actually, documentation of current PageLink states that: > ".If no context is supplied, then the target page itself will supply the > context via a passivate event." > I'm little confused how can PageLink resolve activation context from target > page specified with only its name, when one would actually need an > *instance* of configured page to extract its activation context via > "passivate" event? Or I have mixed up some things here? > > Regards, > Vjeran > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >