本資源引自: Tomcat設(shè)置session超時(shí)的三種方式_Html編程 - 好工具站長分享平臺 http://www./art/1925725 --------------------------------------------------------------------------------------------------------------------------------- =============== Tomcat設(shè)置session超時(shí)的三種方式 ================
Tomcat可以在以下三個(gè)地方設(shè)置session超時(shí): <!-- ==================== Default Session Configuration ================= -->
<!-- You can set the default session timeout (in minutes) for all newly -->
<!-- created sessions by modifying the value below. -->
<session-timeout>30</session-timeout>
在webapp中的 WEB-INF/web.xml
<!-- 配置Session失效時(shí)間 -->
<session-timeout>30</session-timeout>
session.setMaxInactiveInterval(30*60);//以秒為單位
優(yōu)先級,越細(xì)粒度優(yōu)先級越高,也就是3>2>1
|