Session超时设置

方法1:
-项目 web.xml
-单位分钟web

<session-config>
  <session-timeout>2</session-timeout>
 </session-config>

方法2
在Tomcat的/conf/web.xml中session-config,默认值为:30分钟session

<session-config>
        <session-timeout>30</session-timeout>
    </session-config>
**方法3:**  
 在Servlet中设置

HttpSession session = request.getSession(); session.setMaxInactiveInterval(60);//单位为秒code

**补充**  
优先级:Servlet > 项目/web.xml设置 > Tomcat/conf/web.xml设置
相关文章
相关标签/搜索