File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Session timeout problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Session timeout problem" Watch "Session timeout problem" New topic

Session timeout problem

kasthala shyam

Joined: Jun 14, 2008
Posts: 3
Hi all,

We have an application where we have to disable the cookies and use url-rewriting. i want the user to invalidate after some specified time. i have given the <session-timeout> parameter in my web.xml file.


i have given the value as 1 which means 1 minute. when i click the logout link on the particular jsp page (index.jsp) then i am logging out but i want the user to invalidate when i click on any other link on the page after the session expires (i.e., after 1 minute). But i am not able to invalidate after 1 minute.
Can anyone tell me what should i do?
Thanks in advance.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575


fine...then please check the session in next page(the link page),

if session == null then redirect to some page(jsp) with message
HarshalDilip Shah

Joined: Feb 25, 2010
Posts: 5
Use setMaxInactiveInterval(int seconds) and in the next page check if session.isNew() if yes process if no proceed.
HarshalDilip Shah

Joined: Feb 25, 2010
Posts: 5
This is my assumption. You must be having a log out page and one correct page.
If the session is still active when you click on link you should go to correct page
else go to logout page/invalid page. Right?
Then this is the solution.
session.setMaxInactiveInterval(int seconds)

At the begning of new page
if (session.isNew())
redirect to invalid page
continue with this page
I agree. Here's the link:
subject: Session timeout problem
It's not a secret anymore!