*
The moose likes JSF and the fly likes Session cleared after first access 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 "Session cleared after first access" Watch "Session cleared after first access" New topic
Author

Session cleared after first access

Don Blodgett
Ranch Hand

Joined: Jan 09, 2006
Posts: 61
I am using JSF 2.0 with JBoss AS 7. I am attempting to use a session to store some user related information, but the session is somehow being cleared after the first access of the session.

When accessing the session, I use the following contained in the Post Construct of a Session Scoped bean:



When a fresh user navigates to the site the session is null as expected. As a result they are prompted to enter in some information which creates a new session, also contained in a Session Scoped bean, as follows:



The user is then redirected to the outcome page and the session map is accessed as above, this time the session is not null as expected and contains the data as entered. When the user navigates to any other page the session again is null when attempting to access it, even though the JSESSIONID is the same in both cases.

Thanks for any advice on this issue.
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1076
    
  10

Hi,
I think you will get better responses from our JSF forum. Am moving this post there.


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15959
    
  19

It's better to simply inject objects when using JSF instead of doing explicit object location in code.

Nevertheless, you did a session.invalidate() right before you attempted to get the session.


Customer surveys are for companies who didn't pay proper attention to begin with.
Don Blodgett
Ranch Hand

Joined: Jan 09, 2006
Posts: 61
Tim, thank you for your response. You were right I did call the invalidate method, although not the one that I had posted. Anyway you lead me down the path to finding the issue.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session cleared after first access
 
Similar Threads
Problem with Navigation in subview
Session values of a Backing Bean in JSF
login example using jsf
Using timers with phase listeners
Session time out in JSF