[jboss-user] [JBoss Seam] - Re: How are you handling login / registration redirects?
felipevaa
do-not-reply at jboss.com
Fri Jan 26 15:56:23 EST 2007
Here is how I am handling the redirect to the login page and then back to the original page:
1) pages.xml:
| <page view-id="/directory/*" action="#{loginAction.checkLogin}"/>
|
2) loginAction.checkLogin():
| if( user is already logged in )
| {
| return null; // Do nothing (i. e.: proceed with pages.xml chain)
| }
| else
| {
| // Or else, store current view-id on session and redir user to login page
| Contexts.getSessionContext().set("viewIdAfterLogin",
| FacesContext.getCurrentInstance().getViewRoot().getViewId());
| return "/login.xhtml";
| }
|
3) loginAction.login():
| ... // after user and password was validated
|
| String viewIdToRedirect =
| (String)Contexts.getSessionContext().get("viewIdAfterLogin");
| Contexts.getSessionContext().set("viewIdAfterLogin", null);
| return viewIdToRedirect;
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4007021#4007021
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4007021
More information about the jboss-user
mailing list