This sound like a important feature to me. I would prefer option 1. with PageValidationListeners. Would the components register their insterest via a property:
<binding name="valiationListener" expression="true"/>
Regards Malcolm
From: Mind Bridge <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: [Tapestry-developer] Another event needed?
Date: Mon, 28 Oct 2002 15:04:26 -0800 (PST)
Hi,
Consider the following scenario:
A Login component accepts username and password, verifies them, and if they are correct, notifies a listener that is passed via a parameter. The listener can then decide what to do -- display the same page, but place something else at the place of the Login component (as with the Slashdot front page), or, more likely, switch to another page.
Now consider what happens if we want to make the Login component store the identity of the user in a cookie, and if such a cookie is present the next time, automatically "log the user in" and invoke the listener.
This seems easy, but there is a catch -- the earliest time the component can check whether a cookie is present and hence invoke the listener is at the beginning of the render phase (via PageRenderListener or sth like that). At that time, however, it is too late to change the page, since the rendering has already started. (please correct me if I am missing something)
A "manual" way to resolve the issue is to require that the component is placed in a special page that supports "PageValidationListeners", which would allow it to perform the check at validation time and the page change will be possible.
It seems to me that this and other such cases demonstrate the necessity of another listener (event) that will be invoked before the the rendering has started. I see two possible places for it:
1) during validation, as mentioned above
2) before a page is rendered (although it would need to be repeated if the page to render changes as a result). This could be tied in some way with my earlier activatePage() proposal -- it could be implemented using activatePage(), or the opposite, the functionalility of activatePage() could be implemented using such a listener.
Personally, I think that both of those have their place -- being able to perform activities in the components, rather than the pages results in a much higher reusability (we have plenty of such examples in our own work).
What do you think?
Best regards,
-mb and tsvetelin
---------------------------------
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
_________________________________________________________________
Broadband?�Dial-up? Get reliable MSN Internet Access. http://resourcecenter.msn.com/access/plans/default.asp
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Tapestry-developer mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/tapestry-developer
