我需要将我的 j2ee 应用程序的 session 到期时间设置为 4 分 30 秒。
据我所知, session 配置部分只允许几分钟。
<session-config>
<session-timeout>
[Minute]
</session-timeout>
</session-config>
我的问题是,是否可以输入小数值,如 4.5(相当于 4 秒 30 秒)?
<session-config>
<session-timeout>
4.5
</session-timeout>
</session-config>
最佳答案
The default time out period for sessions is defined by the servlet container and can be obtained via the getMaxInactiveInterval method of the HttpSession interface. This time out can be changed by the Developer using the setMaxInactiveInterval method of the HttpSession interface. The time out periods used by these methods are defined in seconds
因此您应该能够使用 setMaxInactiveInterval 方法指定 session 超时。
关于session - 以分钟和秒为单位的 J2EE session 过期设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22688109/