Had an idea recently; another improvement for Tapestry listener methods. Listener methods return void, and if a method wants to activate another page, it must accept the IRequestCycle as a parameter, so it can invoke activate() on it.
What if listener methods could also return a string (the name of a page), or a page instance to activate? Especially paired with injection of pages (and better yet, an annotation), this results in something very flexible and even familiar to Struts and WebWork users.
Just blogging while Eclipse warms up ... should have this written, tested and checked in shortly.
Ok, so its all done, came out great: Tapestry 3.0.x:
public void doShowDetails(IRequestCycle cycle) { Object[] parameters = cycle.getServiceParameters(); Long accountIdLong = (Long)parameters[0]; long accountId = accountIdLong.longValue(); Details page = (Details)cycle.getPage("Details"); page.setAccountId(accountId); cycle.activate(page); }Tapestry 4.0 alpha-3:
public void doShowDetails(IRequestCycle cycle, long accountId) { Details page = (Details)cycle.getPage("Details"); page.setAccountId(accountId); cycle.activate(page); }Tapestry 4.0 beta-1:
@InjectPage("Details") public abstract Details getDetailsPage(); public IPage doShowDetails(long accountId) { Details details = getDetailsPage(); details.setAccountId(accountId); return details; }
1 comment:
It would be great to have
independant configuration of
site map including error pages.
Post a Comment