This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes Session validation/invalidation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Session validation/invalidation" Watch "Session validation/invalidation" New topic
Author

Session validation/invalidation

Bloo Barton
Ranch Hand

Joined: May 09, 2005
Posts: 63
How can I cause a forced session invalidation for timeouts, manual logouts and such when using struts?

How can I check that a session is still valid and the user is still logged in using struts?
Ryan Dillon
Greenhorn

Joined: May 24, 2005
Posts: 11
Hi Bloo,

You can invalidate the session using:

(Note that this is a standard J2EE function, not specific to Struts)


If a session is still valid, then calling:


will return a non-null session. However I have a feeling Struts will automatically create the session (if it does not exist) before any Action is called. You may need to create a custom RequestProcessor or ServletRequestListener to intercept the call before this happens.

Hope that helps.


Ryan Dillon<br />Code Canvas Technologies<br />RapidJ - Rapid Java Web Development<br /><a href="http://www.codecanvas.com.au/rapidj/" target="_blank" rel="nofollow">http://www.codecanvas.com.au/rapidj/</a>
 
jQuery in Action, 2nd edition
 
subject: Session validation/invalidation
 
Similar Threads
MockExamQuestion from HFS
Session Expiry
creating new session after invalidation in same request
session variable
how to check session.invalidate() result ?