常用的有两种方法:
1. 在主页面中写入下面两句:
HttpSession session=request.getSession(true);
session.setMaxInactiveInterval(3600);//3600秒,注意服务器端的3600秒,而不是客户端的
2. 在项目的web.xml中设置:
<session-config>
<session-timeout>60</session-timeout>
</session-config>
这里的60就是60分钟。
还有一种在服务器端设置的方法,因为不同的服务器配置不同,在这就不说了,以上两个就足够用了。

相关文章:

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