⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 onlinelist.java

📁 一个专门用来快速开发网站的框架
💻 JAVA
字号:
package com.ksgl.body.member;/** * <p>Title: literature item </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2007</p> * <p>Company: </p> * @author hj * @version 1.0 */import javax.servlet.*;import javax.servlet.http.*;import java.util.*;import org.apache.commons.logging.LogFactory;import org.apache.commons.logging.Log;import com.ksgl.map.*;public class OnlineList implements HttpSessionAttributeListener {    private static Log log = LogFactory.getLog(OnlineList.class);    private static List list = new ArrayList();    public void attributeAdded(HttpSessionBindingEvent se) {        if ("user".equals(se.getName())) {//            log.info(((T_sys_user)se.getValue()).getName() + "登陆++");            list.add(se.getValue());        }    }    public void attributeRemoved(HttpSessionBindingEvent se) {        if ("user".equals(se.getName())) {//            log.info(((T_sys_user)se.getValue()).getName() + "离线--");            list.remove(se.getValue());        }    }    public void attributeReplaced(HttpSessionBindingEvent se) {        if ("user".equals(se.getName())) {//            log.info(((T_sys_user)se.getValue()).getName() + "Replaced--");            list.remove(se.getValue());        }    }    public static List getList() {        return (list);    }    public static int getActiveSessions() {        return list.size();    }    public static void userRemoved(UserInfo user) {        if(list.contains(user)){            log.info(user.getStrUserName() + "离线");            list.remove(user);        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -