轉自:http://blog.sina.com.cn/s/blog_4adc833f010006nq.html
1web.xml
設置WEB應用程序描述符web.xml裏的<session-timeout>元素。這個值以分鐘爲
單位,並覆蓋weblogic.xml中的TimeoutSecs屬性
<session-config>
<session-timeout>24</session-timeout>
</session-config>
此例表示Session將在24分鐘後過期
當<session-timeout>設置爲-2,表示將使用在weblogic.xml中設置的
TimeoutSecs這個屬性值。
當<session-timeout>設置爲-1,表示Session將永不過期,而忽略在
weblogic.xml中設置的TimeoutSecs屬性值。
該屬性值可以通過console控制檯來設置
2 weblogic.xml
設置WebLogic特有部署描述符weblogic.xml的<session-descriptor>元素的
TimeoutSecs屬性。這個值以秒爲單位
<session-descriptor>
<session-param>
<param-name>TimeoutSecs</param-name>
<param-value>2600</param-value>
</session-param>
</session-descriptor>
默認值是2600秒
3,jsp中控制
session.setMaxInactiveInterval(7200);
session是默認對象,可以直接引用,單位秒s
4,servlet中控制
HttpSession session = request.getSession();
session.setMaxInactiveInterval(7200);
單位秒s