posts - 10,comments - 2,trackbacks - 0
1、jsp页面直接设置
1 // 设置秒数
2 session.setMaxInactiveInterval(10);


2、web.xml设置,会覆盖tomcat下conf/web.xml的session-config设置
<session-config>  
  
<!-- 配置session的超时管理,以分钟为单位 -->  
  
<session-timeout>30</session-timeout>  
</session-config> 


3、如果服务器为tomcat的话,则在conf/web.xml下修改
1 <session-config>
2   <!-- 配置session的超时管理,以分钟为单位 -->
3   <session-timeout>30</session-timeout>  
4 </session-config> 

4、在server.xml中设置超时时间
1 <Context path="/livsorder" docBase="/home/httpd/html/livsorder"      
2   defaultSessionTimeOut="3600" isWARExpanded="true"      
3   isWARValidated="false" isInvokerEnabled="true"      
4   isWorkDirPersistent="false"/> 
优先级:1>2>3>4
posted on 2011-07-21 21:40 showsun 阅读(10135) 评论(1)  编辑  收藏 所属分类: J2EE

FeedBack:
# re: Java Session超时设置
2016-06-12 16:49 | 1212
323243424  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航: