wood burning stoves
The moose likes Struts and the fly likes Session time out. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Session time out." Watch "Session time out." New topic

Session time out.

Arun R. S. Chandran
Ranch Hand

Joined: Oct 08, 2008
Posts: 81
I am new to Struts.
Can anybody guide me how to redirect to login page after specific time using sessions in Struts
I have set
<time-out>1</time-out> in web.xml, but it is not working

Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 689

If you are using Struts 2 then see interceptor for check your session is time out or not.

Otherwise you have to check in jsp for session or use servlet for check your session null or not ?

If your session is null then redirect to login page.

Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
Omar Al Kababji
Ranch Hand

Joined: Jan 13, 2009
Posts: 357
I don't know that much about struts, I will give you a solution for basic JSP and servlets which i think it would be better.

normaly you would be storing the User object in the session, so i would suggest to create a Filter and then in its doFilter method check if there is a user object in the session, if it's not then redirect to the login page.

in the mapping of the filter in the web.xml spcecify to which URL's you want that filter to be applied.

Omar Al Kababji - Electrical & Computer Engineer
[SCJP - 90% - Story] [SCWCD - 94% - Story] [SCBCD - 80% - Story] | My Blog
I agree. Here's the link: http://aspose.com/file-tools
subject: Session time out.
jQuery in Action, 3rd edition