📄 onlinelist.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 + -