UserSessionListener.java
资源名称:(J2EE)oa.rar [点击查看]
上传用户:lm2018
上传日期:2015-12-12
资源大小:30449k
文件大小:1k
源码类别:
Jsp/Servlet
开发平台:
Java
- package com.oa.module.communicate.comm;
- import java.io.IOException;
- import java.io.PrintWriter;
- import javax.servlet.ServletException;
- import javax.servlet.http.HttpServlet;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import javax.servlet.http.HttpSessionEvent;
- import javax.servlet.http.HttpSessionListener;
- import com.oa.module.communicate.comm.chat.PubVar;
- import com.oa.module.office.user.Tuser;
- public class UserSessionListener implements HttpSessionListener {
- public void sessionCreated(HttpSessionEvent arg0) {
- // TODO 自动生成方法存根
- }
- public void sessionDestroyed(HttpSessionEvent event) {
- if (event.getSession().getAttribute("user") != null) {
- Tuser userinfo = (Tuser) event.getSession().getAttribute("user");
- for (int i = 0; i < PubVar.onlineUserList.size(); i++) {
- String username = ((Tuser) PubVar.onlineUserList.get(i))
- .getUname();
- if (userinfo.getUname().equals(username)) {
- PubVar.onlineUserList.remove(i);
- break;
- }
- }
- }
- }
- }