usertrace.java

来自「网上办公管理系统。模拟主流网站办公管理系统的基本业务流程。」· Java 代码 · 共 44 行

JAVA
44
字号
/*
 * Created on 2004-10-12
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
package oa.sys;

import javax.servlet.http.HttpSessionBindingEvent;

public class UserTrace
	implements javax.servlet.http.HttpSessionBindingListener {
	private int id;
	private UserList container = UserList.getInstance();
	
	public UserTrace(){
		id=0;
	}
	
	public void setId(int id) {
		this.id = id;
	}
	
	public int getId() {
		return this.id;
	}
	/* (non-Javadoc)
	 * @see javax.servlet.http.HttpSessionBindingListener#valueBound(javax.servlet.http.HttpSessionBindingEvent)
	 */
	public void valueBound(HttpSessionBindingEvent arg0) {
		System.out.println(new Time().getYMDHMS()+"	上线	"+this.id);
		}
	/* (non-Javadoc)
	 * @see javax.servlet.http.HttpSessionBindingListener#valueUnbound(javax.servlet.http.HttpSessionBindingEvent)
	 */
	public void valueUnbound(HttpSessionBindingEvent arg0) {
		System.out.println(new Time().getYMDHMS()+"	下线	"+this.id);
		if (id != -1) {
			container.removeUser(id);
		}
	}

}

⌨️ 快捷键说明

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