1. 在/conf/web.xml中通过参数指定:
<
session-config
>
<
session-timeout
>180
</
session-timeout
>
</
session-config
>
单位为分钟。
2. 在程序中通过servlet api直接修改:
HttpSession session
=
request.getSession();
session.setMaxInactiveInterval(18
0*60
);
单位为秒,设置为-1永不过期。
本文介绍了两种设置HTTP会话超时的方法:一种是在web.xml文件中通过<session-config>标签配置;另一种是在程序运行时通过servlet API动态调整会话超时时间。
3万+

被折叠的 条评论
为什么被折叠?



