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?
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.