---
title: "web.xml之session超时设置 以及设置session超时的几种方法"
author: "keguan_li"
date: "2016-10-20T16:39:42Z"
tags: []
categories: ["企业架构"]
slug: "web-xml-session-session"
draft: false
lastmod: "2016-10-20T16:39:42Z"
id: 2331936
url: "https://patronli.iteye.com/blog/2331936"
---

<span style="color:red">**web.xml之session超时设置**</span>


<span style="color:red">**先说正题，web.xml之session超时设置 **</span>

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

```


**session超时的其他方法拓展：**
<span style="color:red">**1.在tomcat-5.0.28\conf\web.xml中设置**</span>

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

```


<span style="color:red">**2.通过java代码设置**</span>

```java

session.setMaxInactiveInterval（30*60）;//以秒为单位

```