This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Session timeout manamement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Session timeout manamement" Watch "Session timeout manamement" New topic

Session timeout manamement

Hadler Yunkel

Joined: Aug 21, 2009
Posts: 2
Hi all,
I'm using weblogic 9.2, struts and I am managing the timeout in the web.xml
When the timeout occur I am redirected to the login page.
My problem is I want to show a message like "Timeout! please login again" how can I achieve this?

Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
I am not 100% sure of what I am saying now so you want to check.

Upon timeout, the session is invalidated. Hence sessionDestroyed(HttpSessionEvent e) should be called.

By implementing the HttpSessionListener, then checking inactive time you should be able to achieve what you are looking for.

JDBCSupport - An easy to use, light-weight JDBC framework -
Hadler Yunkel

Joined: Aug 21, 2009
Posts: 2
Thanks Sebastian
if I use a SessionListener and forward the user on the sessionDestroyed method my user will be kicked out without pressing any button and I don't want to force the logout like that, I will prefer to do not implement costom code and live the session managment to my app server
I was wondering if there it can be achieved by configuring web.xml or something

for instance, in my web.xml I've my login form configured like this:


So I can manage the auth false there something for the timeout as well?

Anadi Misra
Ranch Hand

Joined: Jun 03, 2008
Posts: 69
I don't think there is a way completely through web.xml for what you are trying to achieve

You should try giving a message in form of a pop-up surface on the page when you move away from the page. this is usually done by keeping a div in the page in hidden form and showing it when the session times out. you can also use java script to call the login form in this pop up message itself.

Anadi Mishra.
It is sorta covered in the JavaRanch Style Guide.
subject: Session timeout manamement
Similar Threads
Session timeout in struts
Redirecting to Login page on session timeout!!
Prompting to relogin on timeout
Prevent timeout on parent jsp where applet resides
Session timeout problem