• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

session-timeout

 
Brian Smith
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi folks,
i read that we can configure session-time out in web.xml. is there any way that we can get a different page displayed once the specified session-timeout is elapsed? please give some hints or any example.
thanks.
 
Sanjeev Kaushik
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the first page of the application, get the session and put some value in it.
e.g.
HttpSession session = request.getSession(true);
session.setAttribute("Key",somevalue);

After the subsequent requests on the application should follow the following steps
HttpSession session = request.getSession(false);//get the existing session
if(session.getAttribute("Key") == null) {//if it is null session is timed out
response.sendRedirect("some custmized HTML page");
}
This should help you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic