aspose file tools*
The moose likes Servlets and the fly likes Session Timeout Problem in Servlet and JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Session Timeout Problem in Servlet and JSP" Watch "Session Timeout Problem in Servlet and JSP" New topic
Author

Session Timeout Problem in Servlet and JSP

satyaprasad veeramsetti
Greenhorn

Joined: Dec 21, 2012
Posts: 28
Hi Friends,
I have developed simple web-application which contains session timeout using Filter. Please observe the following code.

1) I have created index.jsp as below,



2) I have created servlet as below,




3) I have created jsp as output as below,




4) I have created Filter as below,




5) web.xml file as below,







The actual problem of the above code is 'If one minute is complted, the session will be expired...., But it is not redirecting to index.jsp automatically'


Please help me.
Harry Jones
Greenhorn

Joined: Mar 19, 2010
Posts: 20
I'm not sure whether this will address your particular problem, but I had to exclude index.jsp from the test of the null session. Otherwise I created an infinite loop.
Rajkumar Angare
Greenhorn

Joined: Dec 23, 2012
Posts: 3
Hello Satya,

Set session time out value in web.xml, 1 = one minute, set the value as per your requirement.
Ayan mallick
Ranch Hand

Joined: Nov 17, 2012
Posts: 46
first thing session-timeout means always max inactive interval/the time limit for which session is idle i.e no request is being made.

As fer as i know it automatically doesn't redirect you after session timeout limit.You have to make some request after specified time period in order to check whether session has been
invalidated or not.That time it will redirect you to login page.


If you want to check without making request apply HttpsessionListener concept.
check whether session is being destroyed or not.

please put chain.doFilter inside else block in order to avoid IllegalStateException.

Hope it helps you.
Himanshu bisht bebo
Greenhorn

Joined: Jun 12, 2012
Posts: 16
i think when the response is committed than the filter dofilter method is not called even after the session timeout so it not redirect it to index.jsp
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session Timeout Problem in Servlet and JSP