web.xml配置Session超时时间注意的单位问题
2013-04-29 20:15
302 查看
为单个Web应用 配置超时时间可以在web.xml中使用<session-config>元素,如
....
<web-app>
<!--filter.listener,servlet,and servlet-mapping等元素要在session-config之前-->
<session-config>
<session-timeout>15 </session-timeout>
</session-config>
...
</web-app>
这个时候的“15”单位是分钟!
如果在配置Servlet是指定初始化参数决定超时时间,例如下:
....
<servlet>
<servlet-name>Example</servlet-name>
<servlet-class>exa.mp.le.Example2</servlet-class>
<init-param>
<param-name>timeout</param-name>
<param-value>600</param-value>
</init-param>
...
</servlet>
这时候的“600”单位是秒钟!
另外,我们要注意HttpSession.getMaxInactiveInterval()方法返回的是与秒为单位的;
session.setMaxInactiveInterval(int seconds)方法参数的单位也是秒。
....
<web-app>
<!--filter.listener,servlet,and servlet-mapping等元素要在session-config之前-->
<session-config>
<session-timeout>15 </session-timeout>
</session-config>
...
</web-app>
这个时候的“15”单位是分钟!
如果在配置Servlet是指定初始化参数决定超时时间,例如下:
....
<servlet>
<servlet-name>Example</servlet-name>
<servlet-class>exa.mp.le.Example2</servlet-class>
<init-param>
<param-name>timeout</param-name>
<param-value>600</param-value>
</init-param>
...
</servlet>
这时候的“600”单位是秒钟!
另外,我们要注意HttpSession.getMaxInactiveInterval()方法返回的是与秒为单位的;
session.setMaxInactiveInterval(int seconds)方法参数的单位也是秒。
相关文章推荐
- web.xml配置Session超时时间注意的单位问题
- web.xml配置Session超时时间注意的单位问题
- web.xml配置Session超时时间注意的单位问题
- web.xml配置Session超时时间注意的单位问题
- web.xml配置Session超时时间注意的单位问题
- 2个区别搞懂web.xml配置Session超时时间
- 2个区别搞懂web.xml配置Session超时时间
- 2个区别搞懂web.xml配置Session超时时间
- 2个区别搞懂web.xml配置Session超时时间
- web.xml配置Session超时时间设置
- web.xml中配置session超时过滤器
- java web session有效时间单位问题
- web.xml配置session过期时间
- java web.xml设置session过期时间为15分钟,超时却不会过期
- web.xml文件中配置ShallowEtagHeaderFilter需注意的问题
- web.xml2.3配置需要注意的顺序问题
- 02-解决不能在web.xml中配置action问题
- log4j和web.xml配置webAppRootKey 的问题
- 使用SpringMVC时添加了web.xml中的DispatchServlet配置后出现Tomcat服务器无法启动的问题
- 关于web.xml中配置404错误跳转页面 在ie不能显示自定义错误页面的问题