File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Android Security Essentials Live Lessons this week in the Android 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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I "force create" a new session in JSF
 
Similar Threads
JSF2 + EJB3 + JPA to perform authentication and authorization.
Session creation on click of new menu Tab
How to handle session in jsf??
JSF to Struts conversion
Session Expire due to time out: Please Help