User implements HttpSessionBindingListener
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--;
}
}
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。