Web容器

apache-tomcat-8.0.26\conf\web.xml中设置

<session-config>  
     <!-- 时间单位为分钟,-1为用不失效 -->  
     <session-timeout>30</session-timeout>  
</session-config>  

Web工程

在项目工程的web.xml中设置

     <session-config>
           <!-- 时间单位为分钟,-1为永不失效 -->  
           <session-timeout>15</session-timeout>
     </session-config>

Java代码

  //以秒为单位
   session.setMaxInactiveInterval(30*60);

三种方式优先级:web容器 < web项目 < java代码

 

相关文章:

  • 2022-01-22
  • 2021-09-22
  • 2022-01-30
  • 2021-10-31
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-10
  • 2022-12-23
  • 2021-06-09
  • 2021-12-11
相关资源
相似解决方案