1. Defined in a separate XML corresponding to the Tomcat-->conf-->servler.xml file or application:
Add the Defaultsessiontimeout property value in the context node, in seconds, and the sample code is as follows:
<context docbase= "D:\My documents\workspace\demo\webroot" path= "" reloadable= "true" debug= "0" defaultsessiontimeout= "3600" ></Context>
<context docbase= "D:\My documents\workspace\demo\webroot" path= "" reloadable= "true" debug= "0" defaultsessiontimeout= "3600" ></Context> 2. As defined in Web. XML, the Session-config node is added under the website node, which is divided into the sample code as follows:
<session-config>
<session-timeout>60</session-timeout>
</session-config>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
If you define a session in the Tomcat-->conf-->web.xml file that represents all Web settings under Tomcat
3. Defined in the program, in seconds, set to 1 to never expire, the sample code is:
Session.setmaxinactiveinterval (30*60);
The priority of the session setting effect is, the first program after the configuration, the first local after the whole.
There are 3 ways to set session time