You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Francisco Passos <fr...@gmail.com> on 2007/07/13 19:06:45 UTC

Login filter + redirect to previous

Good afternoon.

I'm using a filter to check for a session bean with user login details and
redirecting to a login page to enforce the user to login once more if the
session has expired or if the user is not logged in.

I'd like to know which alternatives I have to redirect the user after the
login to the page he intended to go in the first place.


Thank you,
Francisco Passos

RE: Login filter + redirect to previous

Posted by "Kito D. Mann" <km...@virtua.com>.
 

From: Francisco Passos [mailto:francisco.passos@gmail.com] 
Sent: Friday, July 13, 2007 1:07 PM
To: MyFaces Discussion
Subject: Login filter + redirect to previous

 

Good afternoon.

I'm using a filter to check for a session bean with user login details and
redirecting to a login page to enforce the user to login once more if the
session has expired or if the user is not logged in. 

I'd like to know which alternatives I have to redirect the user after the
login to the page he intended to go in the first place.

 

A simple approach is to put the originally requested page in the session.
You can then wire up that value to the login bean via the MBCF, and your
login bean can call ExternalContext.dispatch() to forward the user to the
appropriate page upon completion. Note that you should clear the value from
the session when you're finished with it.

 

Another approach is to have a session-scoped bean hold the value instead of
storing it directly in the session. You would still wire up this bean to
your login bean. 

 

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kito D. Mann - Author, JavaServer Faces in Action
 <http://www.virtua.com/> http://www.virtua.com - JSF/Java EE consulting,
training, and mentoring
 <http://www.jsfcentral.com/> http://www.JSFCentral.com - JavaServer Faces
FAQ, news, and info



 

* Sign up for the JSF Central newsletter!
<http://oi.vresp.com/?fid=ac048d0e17> http://oi.vresp.com/?fid=ac048d0e17 *