Hello everyone!
I would like to provide a "logout" button on just about every html-page that i render in my WO-Application which would set some session variables back to null and redirect the user to the 'Main' page.
However i'm failing at finding the right spot to implement/provide something that i believe should look roughly like this: ((Session)session()).currentUser = null; return application().pageWithName("Main", this.context());
Now while i know that just about anyone of you guys on this list could have answered my question after the first line of this email already i'd still like to explain why i got so stuck on this particular scenario in the hope of learning a bit more should someone care to go into a bit more detail on these thoughts:
First i thought that Session.java might be a good place, since it's readily available to all WOComponents. But i can't seem to be able to use the 'application().pageWithName("Main", this.context());' in there. Because Session.java knows nothing of a context() i'm assuming?
Then i thought i could just implement it in the Main.java as a static method and link to that from all other WOComponents but this seems highly weird and at least WebObjects Builder wouldn't let me drag cross references from an element on one WOComp. to an action/key on another WOComp. So i figured it's not provided for a good reason...
As always i'm very grateful for any input, pointers to good reads or any other kind of info that could help me.
Thank you * very much and a merry, peaceful and blessed x.mas time to all of us.
-Malte Philipp |