File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Session validation/invalidation" Watch "Session validation/invalidation" New topic

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

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="" target="_blank" rel="nofollow"></a>
I agree. Here's the link:
subject: Session validation/invalidation
It's not a secret anymore!