---
title: "Java EE 中 http Session有关问题"
author: "maimode"
date: "2012-06-07T17:01:44Z"
tags: []
categories: ["互联网"]
slug: "java-ee-http-session"
draft: false
lastmod: "2012-06-07T17:01:44Z"
id: 1554604
url: "https://maimode.iteye.com/blog/1554604"
---

有关session的介绍参见[http://com-xpp.iteye.com/blog/1553777](http://com-xpp.iteye.com/blog/1553777)

 

下面说一下session状态失效的检测方法：（引用别人的资料）

 

http://topic.csdn.net/t/20031204/21/2528823.html帖子中symfkj作者的回复 写道

1.HttpSession session=request.getSession(false);  
if(session==null){已经invalidate}  
2.HttpSession session=request.getSession(true);  
if(session.isNew()){已经invalidate}  
3.使用HttpSessionListener，在sessionDestroyed(HttpSessionEvent se)方法里完成你invalidate以后的工作，如：让客户重新登陆。  
如果你还有问题，可以发mail给我，zhangfm@neusoft.com