Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session timeout problem

 
kasthala shyam
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

<session-timeout>1</session-timeout>

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
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


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
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use setMaxInactiveInterval(int seconds) and in the next page check if session.isNew() if yes process if no proceed.
 
HarshalDilip Shah
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
.
.
link.....

At the begning of new page
if (session.isNew())
{
redirect to invalid page
}
else
{
continue with this page
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic