Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session time out.

 
Arun R. S. Chandran
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

Regards,
Arun
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,
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.

 
Omar Al Kababji
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic