| Author |
how to return a page to infor client when the session time out ?
|
luxica peng
Greenhorn
Joined: Jun 02, 2005
Posts: 5
|
|
Hello,everyone: I have seen on some web a page may return to browser when the session time out.I only know the HttpSessionListner has this function.but we often use a response to return page,from the listner we can get the session by the HttpSessionEvent,but how can I get the response?
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
You don't need a listener for this. When the user logs in, bind an object to session (let's call it 'userBean'). With every subsequent request, check for the existence of this object. If request.getSession().getAttribute("userBean") is null then the user has either not logged in or has let their session time out. In that case forward or redirect to the login page. A filter makes it easy to put this checking fuctionality in front of every request without having to update all of your servlets. I have an example app that does this on: http://simple.souther.us/not-so-simple.html Look for SessionMonitor
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
luxica peng
Greenhorn
Joined: Jun 02, 2005
Posts: 5
|
|
|
this is valuably.thanks,Ben.
|
 |
 |
|
|
subject: how to return a page to infor client when the session time out ?
|
|
|