1. Set in the web container (Tomcat as an example)
Set in Tomcat-5.0.28/Conf/Web.xml. The following is the default configuration in Tomcat 5.0:
Copy code code as follows:
<!-- ==================== Default Session Configuration ================= -->
<!-You can set the default session time (in minutes) for all newly->
<!-Created sessions by modifying the value below.->
<session-config>
<session-timeout> 30 </session-timeout>
</session-config>
Tomcat's default session timeout time is 30 minutes. You can modify it as needed. Negative or 0 is an inductance time for the session.
2. Set the <br /> copy code code in the web.xml of the project as follows: as follows:
<!-Time unit is minute->
[html] View Plaincopy
<session-config>
<session-timeout> 15 </session-timeout>
</session-config>
3. Copy code code with java code <br /> as follows: as follows:
session.setmaxinactiveInterval (30*60); //