Checking for session expiration

November 30

We're using JSPs and Servlets in our application. Looking for a way in code to check if the session has expired. We will need to do this from a jsp as well as a servlet (sometimes a jsp is pointed to by a link and sometimes a servlet). Can someone point me in the right direction?
Thanks all.



I like the idea of a session verifier. We have about 25 jsps, 15 servlets, and at least 80 components (beans) in the app. How would the verifier component work? How could we intagrate it with all the other existing components? Ideally it would be integrated with minimal modifications...
Is the following what you had in mind with your suggestion to check for session data:
HttpSession session = request.getSession();
//or could this be used too: HttpSession session = pageContext.getSession();
String valid = session.getAttribute( KEY );
if ( null != valid ) {
//then the session is still active
If the session has expired and you current have a new
session, then use the isNew() method to check the
session object. Or, you could check the session
object for the data you are looking for. If it is
missing, then the session expired and has been newly
created. You should build into your design a session
verifier so that you don't expierence NullPointers or
missing data.

View 4 Replies


  1. arp mac aging best practices
  2. macbook pro periodic sound
  3. labview daqパルス出力
  4. CL_SQL_RESULT_SET=============CP
  5. HRDM
  6. E317
  7. DCD5
  8. highesta4n
  9. 1DC5
  10. DAQmx_Val_ChanPerLine
Copyrights 2019 Fcffair BigData Resource, All rights reserved