0

In a servlet page I set a session.

How much time will live?

 if( session.getAttribute!=null){

  while( rs.next())
     name=rs.getString("name");
     addres=rs.getString("address");
  }

Thank you

nancy
  • 175
  • 1
  • 8

1 Answers1

0

Basically the session is alive as long as the user doesn't close her/his browser, or the session timeout is reached (default: 30min). You can define the maximum timeout using

<session-config>
    <session-timeout>60</session-timeout>
</session-config> 

in your deployment descriptor or in code using session.setMaxInactiveInterval(3600); The purpose of a session is to keep information on server-side between each request. Maybe you want to also read about session tracking..have a look here: Session or cookie confusion

Community
  • 1
  • 1
eol
  • 23,236
  • 5
  • 46
  • 64