> Each class can have as many onActivate() methods as you want. But I would > have a single onActivate(EventContext context) method and let the > subclasses override it. Or define a method like process(EventContext > context) and call it from a final onActivate(EventContext) method.
If I overwrite the onActivate() method and put my code there, this code that needs to be executed on every page gets overwritten as well (and I have to duplicate it on every page). One solution would be to create an initialize() method that needs to be called by every page at the end of their onActivate(). But I hoped for a cleaner solution :-) Example: I hoped for an automatic way to call the initialize() method. In onActivate it doesnt make sense because maybe MyPage2 wont use the username as activation context but something else. And if any page overwrites the activation context I am getting problems as well. BasePage.java: --------------------------------------------------------------------- abstract class BasePage() { @Property private String statusmessage; initialize() { this.statusmessage = getUser().getStatusMessage(); } abstract User getUser(); } } -------------------------------------------------------------- class MyPage() extends BasePage { private User user; onActivate(String username) { user = repository.findByUsername(username); } User getUser() { return user; } -------------------------------------------------------------- Piero --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org