Session超時設置

Java Session超時設置

1jsp頁面直接設置

// 設置秒數
 session.setMaxInactiveInterval(10);

2web.xml設置,會覆蓋tomcatconf/web.xmlsession-config設置
<session-config>  
  <!-- 配置session的超時管理,以分鐘爲單位 -->  
  <session-timeout>30</session-timeout>  
</session-config> 

3、如果服務器爲tomcat的話,則在conf/web.xml下修改

<session-config>
  <!-- 配置session的超時管理,以分鐘爲單位 -->
  <session-timeout>30</session-timeout>  
 </session-config> 

注意優先級:1>2>3
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章