2012-10-17 113 views
27

我必须测试由spring和jsp编写的web应用程序。应用程序的默认会话超时时间为30分钟。更改弹簧web应用程序的默认会话超时

我想减少会话超时。为此,我在tomcatInstallationLocation/conf/web.xml文件中进行了更改。但它不起作用。在tomcatInstallationLocation/conf/web.xml默认配置是 -

<session-config> 
    <session-timeout>30</session-timeout> 
</session-config> 

在哪里,我只是改变了时间,并使其 -

<session-config> 
    <session-timeout>5</session-timeout> 
</session-config> 

,但仍无法正常工作。据我所知,在这种情况下,我必须改变我的弹簧应用程序的web.xml。但我不确定。谁能帮我?

在此先感谢。

回答

50

会话超时层次结构:

  • $tomcat_home/conf/web.xml
  • $your_webapp/WEB-INF/web.xml
  • HttpSession.setMaxInactiveInterval(int)

每个后续条目的手动调用覆盖在其他之上。