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