美文网首页
Session设置有效期的两种方式

Session设置有效期的两种方式

作者: CryFace | 来源:发表于2020-05-06 16:44 被阅读0次

(1)服务器下配置
我们可以打开tomcat->conf->web.xml
然后用记事本打开,Ctrl+f搜索session-config


就可以进行配置,单位是分钟,默认是30分钟。
(2)代码直接配置
request.getSession().setMaxInactiveInterval(30); 

单位是秒,可以自行设置。

相关文章

网友评论

      本文标题:Session设置有效期的两种方式

      本文链接:https://www.haomeiwen.com/subject/hkvwghtx.html