Monday, December 10, 2012

How to set session timeout for Tomcat

In web applications every user is identified by a session. The session holds information about the user. A typical example is an internet shop: the contents of your shopping cart is stored in a session.
To prevent the number of sessions to increase infinitely, they are destroyed after certain time of inactivity (time without changing the page) from the user. This is called session timeout. All user data stored in the session disappears (e.g. you have fill your shopping cart again). Sometimes the default session timeout may be too low, especially when the user is expected to spend a lot of time on a single page. To increase the timeout value in Tomcat, please locate the following section in [Tomcat_home]/conf/web.xml:
  The timeout value is specified in minutes.Restart Tomcat after modifying the file, so the changes can take effect.