This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSF and the fly likes Login Page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Login Page" Watch "Login Page" New topic
Author

Login Page

Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
Ok. I have 3 jsp pages - login.jsp, a.jsp and b.jsp

The user needs to authenticate himself (via login.jsp) before accessing a.jsp and b.jsp.

Currently if i goto a.faces or b.faces (without logging in) i am presented with the page (populated with the default values for the backing bean). Instead, I would like to redirect the user to the login page.


MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
g madhava
Ranch Hand

Joined: Sep 14, 2001
Posts: 85
Some ways in which you could handle this.

1] First you could write a Servlet filter which would check if the user is already logged in. If not take the user to the login page.

2] The other option would be to use the JSF Navigation Handler mechanism.

An example is at this site.

http://www.jsftutorials.net/jsfNavigation/jsf-login-navigation-redirect.html
 
jQuery in Action, 2nd edition
 
subject: Login Page