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設置
相關文章
相關標籤/搜索