-
大小: 8.85 KB文件類型: .rar金幣: 2下載: 1 次發布日期: 2024-08-26
- 語言: Java
- 標簽:
資源簡介
jsp 統計在線人數實例,是個完整的項目實例,部署即可查看效果!
通過使用:HttpSessionListener、HttpSessionBindingListener來實現.
valueBound 方法登錄觸發。
valueUnbound 方法退出觸發。
通過使用:HttpSessionListener、HttpSessionBindingListener來實現.
valueBound 方法登錄觸發。
valueUnbound 方法退出觸發。
代碼片段和文件信息
/*
?*?Created?on?2004-10-21
?*
?*?TODO?To?change?the?template?for?this?generated?file?go?to
?*?Window?-?Preferences?-?Java?-?Code?style?-?Code?Templates
?*/
package?com.test;
/**
?*?@author?Administrator
?*?
?*?TODO?To?change?the?template?for?this?generated?type?comment?go?to?Window?-
?*?Preferences?-?Java?-?Code?style?-?Code?Templates
?*/
import?java.util.List;
import?java.util.ArrayList;
public?class?OnlineCounter?{
private?static??final?List?list?=?new?ArrayList();
private?OnlineCounter()?{
}
public?static?void?addUser(String?username)?{
if((username.length()>2)?&&?!list.contains(username)){
System.out.println(“addUser“);
list.add(username);
}
}
public?static?void?removeUser(String?username){
????????System.out.println(username);
if((username!=null)?&&?list.contains(username)){
list.remove(username);
System.out.println(“removeUser“);
}
}
public?static?int?getOnlineCount()?{
//返回當前在線人數
return?list.size();
}
public?static?List?getOnline()?{
return?list;
}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1224??2009-03-31?21:36??online\.project
?????文件????????292??2009-04-14?14:33??online\.myme
?????文件????????340??2009-03-31?10:39??online\.classpath
?????文件???????1040??2009-03-31?21:43??online\.settings\com.genuitec.eclipse.j2eedt.core.prefs
?????文件????????737??2009-04-01?15:28??online\WebRoot\login.jsp
?????文件????????745??2009-03-31?21:40??online\WebRoot\logout.jsp
?????文件???????1677??2009-04-01?15:31??online\WebRoot\success.jsp
?????文件????????567??2009-03-31?21:41??online\WebRoot\online.jsp
?????文件?????????39??2009-03-31?10:39??online\WebRoot\me
?????文件????????486??2009-03-31?20:54??online\WebRoot\WEB-INF\web.xm
?????文件???????1909??2009-04-01?14:02??online\WebRoot\WEB-INF\classes\com\test\UserBean.class
?????文件???????1164??2009-04-01?14:02??online\WebRoot\WEB-INF\classes\com\test\OnlineCounter.class
?????文件????????967??2009-04-01?14:02??online\WebRoot\WEB-INF\classes\com\test\OnLineSessionListener.class
?????文件???????1358??2009-03-31?11:50??online\src\com\test\UserBean.java
?????文件???????1070??2009-03-31?16:21??online\src\com\test\OnlineCounter.java
?????文件???????1082??2009-03-31?16:18??online\src\com\test\OnLineSessionListener.java
?????目錄??????????0??2009-04-01?14:02??online\WebRoot\WEB-INF\classes\com\test
?????目錄??????????0??2009-04-01?14:02??online\WebRoot\WEB-INF\classes\com
?????目錄??????????0??2009-04-01?14:01??online\WebRoot\WEB-INF\classes
?????目錄??????????0??2009-04-01?14:01??online\WebRoot\WEB-INF\lib
?????目錄??????????0??2009-04-01?14:01??online\src\com\test
?????目錄??????????0??2009-04-01?14:01??online\WebRoot\me
?????目錄??????????0??2009-04-01?14:01??online\WebRoot\WEB-INF
?????目錄??????????0??2009-04-01?14:01??online\src\com
?????目錄??????????0??2009-04-01?14:01??online\.settings
?????目錄??????????0??2009-04-01?14:01??online\.myeclipse
?????目錄??????????0??2009-04-01?14:01??online\WebRoot
?????目錄??????????0??2009-04-01?14:01??online\src
?????目錄??????????0??2009-04-01?14:01??online
-----------?---------??----------?-----??----
............此處省略2個文件信息
- 上一篇:java 局域網數據包嗅探
- 下一篇:java做的人事檔案管理系統
評論
共有 條評論