锘??xml version="1.0" encoding="utf-8" standalone="yes"?>精品三级在线,欧美日韩人人澡狠狠躁视频,日韩av不卡在线播放http://www.aygfsteel.com/jnzgrass/category/18500.htmlzh-cnTue, 27 Feb 2007 12:46:24 GMTTue, 27 Feb 2007 12:46:24 GMT60- 鍏充簬JSP鍦ㄧ嚎鏄劇ず鍙婂崟浜虹櫥闄嗚В鍐沖姙娉?/title>http://www.aygfsteel.com/jnzgrass/articles/96129.html涓滆垷涓滆垷Fri, 26 Jan 2007 05:42:00 GMThttp://www.aygfsteel.com/jnzgrass/articles/96129.htmlhttp://www.aygfsteel.com/jnzgrass/comments/96129.htmlhttp://www.aygfsteel.com/jnzgrass/articles/96129.html#Feedback0http://www.aygfsteel.com/jnzgrass/comments/commentRss/96129.htmlhttp://www.aygfsteel.com/jnzgrass/services/trackbacks/96129.html褰撶敤鎴風櫥褰曟椂緇存姢涓涓細璇濆璞★細UserInfo綾葷殑瀹炰緥錛屽悓鏃禪serInfo綾誨疄鐜癹avax.servlet.http.HttpSessionBindingListener鎺ュ彛:
import聽JAVA.util.Map;
import聽JAVA.util.HashMap;
import聽javax.servlet.http.*;
import聽javax.servlet.ServletContext;
public聽class聽UserInfo聽implements聽HttpSessionBindingListener聽{
//聽鐢ㄦ埛淇℃伅
int聽userId;
String聽userName;
......
/**
聽*聽褰揢serInfo綾昏緇戝畾鍒皊ession涓椂瑙﹀彂榪欎釜浜嬩歡
聽*聽鍏蜂綋淇℃伅璇峰弬瑙丼ervlet/JSPs鐨勮鑼?
聽*/
public聽void聽valueBound(HttpSessionBindingEvent聽event)聽{
HttpSession聽session聽=聽event.getSession聽();
ServletContext聽ctx聽=聽session.getServletContext聽();
Map聽map聽=聽(Map)ctx.getAttribute聽("users");
if聽(map聽==聽null)聽{聽//聽濡傛灉鏄湇鍔″櫒鍚姩鍚庣殑絎竴涓櫥褰曠敤鎴鳳紝鏂板緩涓涓鍣?
map聽=聽new聽HashMap聽();
ctx.setAttribute聽("users",聽map);
}
map.put聽(userName,聽this);聽//聽鎶婅嚜宸卞姞鍏ュ鍣ㄤ腑
}
/**
聽*聽褰揢serInfo綾諱粠session涓垹闄ゆ椂瑙﹀彂榪欎釜浜嬩歡
聽*聽鍏蜂綋淇℃伅璇峰弬瑙丼ervlet/JSPs鐨勮鑼?
聽*/
public聽void聽valueUnbound(HttpSessionBindingEvent聽event)聽{
HttpSession聽session聽=聽event.getSession聽();
ServletContext聽ctx聽=聽session.getServletContext聽();
Map聽map聽=聽(Map)ctx.getAttribute聽("users");
map.remove聽(this.userName);聽//聽鎶婅嚜宸變粠瀹瑰櫒涓垹闄?
}
......
}
浠ュ悗鍦↗SP涓氨鍙互榪欐牱鏄劇ず鍦ㄧ嚎鐢ㄦ埛鏁頒簡錛?
<%
int聽userCount聽=聽0;
JAVA.util.Map聽map聽=聽(java.util.Map)application.getAttribute聽("users");
if聽(map聽==聽0)聽userCount聽=聽0;
else聽userCount聽=聽map.size聽();
%>;

]]>
主站蜘蛛池模板:
遂昌县|
扶沟县|
望都县|
揭东县|
肇州县|
泽州县|
阿鲁科尔沁旗|
湖南省|
竹北市|
常熟市|
永泰县|
新巴尔虎左旗|
金华市|
南通市|
会理县|
临海市|
普定县|
余江县|
双柏县|
怀仁县|
嘉祥县|
曲水县|
北票市|
兰溪市|
晋江市|
惠来县|
南部县|
元谋县|
江孜县|
高雄县|
马公市|
塘沽区|
西城区|
亳州市|
洮南市|
惠安县|
鲜城|
务川|
民丰县|
额敏县|
徐水县|