Thiago,
thanks very much. That's basically what I did, and it works, but I don't like:
a) not having a passivate method (I have no need of one yet) and
b) I feel (due to the examples in the documentation) that activate should take a parameter as the id of some object I want to resurrect.

No doubt, I'll get used to it.
Ciao,
Jonathan

On 16/01/2009 15:55, Thiago HP wrote:
On Fri, Jan 16, 2009 at 1:42 PM, Jonathan O'Connor<ninki...@eircom.net>  wrote:
Hi,

Hi!

I have been reading the documentation, and I haven't seen what I need to
find out: How can a page finding that the user is not logged in, it should
jump to a login page, and optionally jump back to the requested page?

Use onActivate. One way to do it:

@InjectPage
private LoginPage loginPage;

Object onActivate() {
     if (user is not logged in) {
         // you could set any properties in the login page here.
         return loginPage;
     }
     else {
         return null; // continue rendering this page normally.
     }
}

On the other hand, if you need this behaviour to be applied to more
than one page, a RequestFilter would be the best way, as this would
put all the code in a single place and the pages wouldn't need to
bother with this issues. In this mailing list you can find some
examples, maybe in the wiki too. ;)


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to