How can I prevent the expiration of a Session?

Alessandro A. Garbagnati

You can change the "timeout" value in two ways.

  1. To change one or more session (but on a per-session basis), use the setMaxInactiveInterval(int interval) method of the javax.servlet.http.HttpSession interface, passing any value in seconds. If you use a negative value, the session will never expire.
  2. To change all the sessions, use the web application descriptor (web.xml):

    If you want the container to never timeout a session, use a [MINUTES] value 0 or less.
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact