public class User implements HttpSessionBindingListener {
private int id;
private String userName;
private String password;
private String email;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Override
public void valueBound(HttpSessionBindingEvent arg0) {
//存入session时自动调用
Constants.ONLINE_USER_COUNT++;
}
@Override
public void valueUnbound(HttpSessionBindingEvent arg0) {
//从session中删除时自动调用
Constants.ONLINE_USER_COUNT--;
}
}