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 How do I 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 "How do I "force create" a new session in JSF" Watch "How do I "force create" a new session in JSF" New topic
Author

How do I "force create" a new session in JSF

Walter Chen
Greenhorn

Joined: Jan 10, 2003
Posts: 25
Hi, group:

In our system we use JSF, we have a log-in page and want to always create a new HTTP session when the user accesses this page. The reason is sometimes users do not always log out of their previous session and they try to log in again (could be a different user), but the session data will still remain there.

Is there a header or something in the JSF code that we can use to force create a new session?

Thanks,
Walter
Andres Quinones
Ranch Hand

Joined: Oct 09, 2006
Posts: 57
Originally posted by Walter Chen:
Hi, group:

In our system we use JSF, we have a log-in page and want to always create a new HTTP session when the user accesses this page. The reason is sometimes users do not always log out of their previous session and they try to log in again (could be a different user), but the session data will still remain there.

Is there a header or something in the JSF code that we can use to force create a new session?

Thanks,
Walter


Walter what you can do is add this code to the method where you do the authentication of the user
HttpSession ses = ( HttpSession ) FacesContext.getCurrentInstance().getExternalContext().getSession( true );

I hope this helps
 
wood burning stoves
 
subject: How do I "force create" a new session in JSF