This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes session-timeout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "session-timeout" Watch "session-timeout" New topic


Brian Smith
Ranch Hand

Joined: Oct 26, 2002
Posts: 232
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.
Sanjeev Kaushik
Ranch Hand

Joined: Aug 01, 2002
Posts: 105
In the first page of the application, get the session and put some value in it.
HttpSession session = request.getSession(true);

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.

Sanjeev Kaushik
I agree. Here's the link:
subject: session-timeout
Similar Threads
How to Handle timeout to save user input
Tune stateful EJB configurations
some about apache tomcat session?
Session Expire due to time out: Please Help
Difference between ActionContext.getContext().getSession() and HttpSession