---
title: "页面“长时间”操作引起的Session过期"
author: "tomkoo"
date: "2007-10-11T13:31:49Z"
tags: []
categories: ["企业架构"]
slug: "session"
draft: false
lastmod: "2007-10-11T13:31:49Z"
id: 131046
url: "https://tomkoo.iteye.com/blog/131046"
---

在Servlet Specification 2.4中对Session的过期有这样的一句描述：

> 
> The session invalidation will not take effect until all servlets using that session have exited the service method.
> 


所以，如果client跟server没有交互，那么session过期时间就开始计算了。

但是在实际应用中，我遇到了这样的问题：

客户要求系统5分钟不操作Session就过期。但是我们有一项功能“银企对账”，需要在页面上对2000多条数据进行勾选，这个勾选完全是页面的操作，同Server没有任何交互，但是由于数据量大，勾选的时间远远超过5分钟，当勾选完后执行操作时，Session已经过期了。

这样的矛盾如何解决？设置自动同Server交互以维持Session？Or Other？