锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久夜色精品国产噜噜亚洲a,亚洲日韩欧洲无码av夜夜摸,亚洲一级免费视频http://m.tkk7.com/zhuyuanxiang/articles/127460.html鏈辮繙緲?Apusic鎶鏈敮鎸佸伐紼嬪笀鏈辮繙緲?Apusic鎶鏈敮鎸佸伐紼嬪笀Mon, 02 Jul 2007 03:31:00 GMThttp://m.tkk7.com/zhuyuanxiang/articles/127460.htmlhttp://m.tkk7.com/zhuyuanxiang/comments/127460.htmlhttp://m.tkk7.com/zhuyuanxiang/articles/127460.html#Feedback0http://m.tkk7.com/zhuyuanxiang/comments/commentRss/127460.htmlhttp://m.tkk7.com/zhuyuanxiang/services/trackbacks/127460.html銆JSP浣滀負鍚庤搗涔嬬鑳藉鍦ㄦ湇鍔″櫒緙栫▼鐜涓崰鎹竴瀹氬湴浣嶏紝鏄拰瀹冭壇濂芥敮鎸佷竴緋誨垪涓氱晫鏍囧噯瀵嗗垏鐩稿叧鐨勩係ession灝辨槸瀹冩彁渚涚殑鍩虹璁炬柦涔嬩竴銆備綔涓轟竴涓▼搴忓憳錛屼綘鍙互涓嶄粙鎰忓叿浣撳湪瀹㈡埛绔槸濡備綍瀹炵幇錛屽氨鏂逛究鐨勫疄鐜扮畝鍗曠殑鍩轟簬session鐨勭敤鎴風鐞嗐傜幇鍦ㄥ浜庡鐞嗗湪綰跨敤鎴鳳紝鏈夊嚑縐嶄笉鍚岀殑澶勭悊鏂規硶銆?/p>

銆銆涓縐嶆槸欏甸潰鍒鋒柊鐢辯敤鎴鋒帶鍒訛紝鏈嶅姟鍣ㄧ鎺у埗涓涓秴鏃舵椂闂存瘮濡?0鍒嗛挓錛屽埌浜嗘椂闂翠箣鍚庣敤鎴鋒病鏈夊姩浣滃氨琚涪鍑恒傝繖縐嶆柟娉曠殑浼樼偣鏄紝濡傛灉鐢ㄦ埛蹇樹簡閫鍑猴紝鍙互闃叉鍒漢鎭舵剰鎿嶄綔銆傜己鐐規槸錛屽鏋滀綘鍦ㄥ仛涓浠跺緢鑰楁椂闂寸殑浜嬫儏錛岃秴榪囦簡榪欎釜鏃墮棿闄愬埗錛宻ubmit鐨勬椂鍊欏彲鑳借鍐嶆闈復鐧婚檰銆傚鏋滃師鏉ョ殑鍙墮潰鍙堟槸寮哄埗澶辨晥鐨勮瘽錛屽氨鏈夊彲鑳戒涪澶變綘鍋氱殑宸ヤ綔銆傚湪瀹炵幇鐨勮搴︽潵鐪嬶紝榪欐槸鏈綆鍗曠殑錛孲erver绔粯璁ゅ疄鐜扮殑灝辨槸榪欐牱鐨勬ā寮忋?/p>

銆銆鍙︿竴縐嶆柟寮忔槸錛岀珯鐐歸噰鐢ㄦ鏋剁粨鏋勶紝鏈変竴涓狥rame鎴栬呴殣钘忕殑iframe鍦ㄤ笉鏂埛鏂幫紝榪欐牱浣犳案榪滀笉浼氳韙㈠嚭錛屼絾鏄湇鍔″櫒绔負浜嗗垽鏂綘鏄惁鍦ㄧ嚎錛岄渶瑕佸畾涓涓彂鍛嗘椂闂達紝濡傛灉瓚呰繃榪欎釜鍙戝憜鏃墮棿浣犻櫎浜嗚繖涓嚜鍔ㄥ埛鏂扮殑欏甸潰澶栨病鏈夊埛鏂板叾浠栭〉闈㈢殑璇濓紝灝辮涓轟綘宸茬粡涓嶅湪綰夸簡銆傞噰鍙栬繖縐嶆柟寮忕殑鍏稿瀷鏄痻ici.net銆?浠栫殑浼樼偣鏄彲浠ュ彲浠ュ埄鐢ㄤ笉鏂殑鍒鋒柊瀹炵幇涓浜涚被浼約erver-push鐨勫姛鑳斤紝姣斿緗戝弸涔嬮棿鍙戦佹秷鎭?/p>

銆銆涓嶇鍝竴縐嶆ā寮忥紝涓轟簡瀹炵幇嫻忚褰撳墠鎵鏈夌殑鍦ㄧ嚎鐢ㄦ埛錛岃繕闇瑕佸仛涓浜涢澶栫殑宸ヤ綔銆俿ervlet API涓病鏈夊緱鍒癝ession鍒楄〃鐨凙PI銆?/p>

銆銆鍙互鍒╃敤鐨勬槸Listener. Servlet 2.2鍜?.3瑙勮寖鍦ㄨ繖閲岀暐寰湁涓浜涗笉涓鏍楓?.2涓璈ttpSessionBindingListener鍙互瀹炵幇褰撲竴涓狧TTPSession涓殑Attribute鍙樺寲鐨勬椂鍊欓氱煡浣犵殑綾匯傝?.3涓繕寮曞叆浜咹ttpSessionAttributeListener.閴翠簬鎴戜嬌鐢ㄧ殑鐜鏄疺isual age for java 4鍜孞Run server 3.1,浠栦滑榪樹笉鐩存帴鏀寔Servlet 2.3鐨勭紪紼嬶紝榪欓噷鎴戠敤鐨勬槸HttpSessionBindingListener.

銆銆闇瑕佸仛鐨勪簨鎯呭寘鎷仛涓涓柊鐨勭被鏉ュ疄鐜癏ttpSessionBindingListener鎺ュ彛銆傝繖涓帴鍙f湁涓や釜鏂規硶錛?/p>

public void valueBound(HttpSessionBindingEvent event)
public void valueUnbound(HttpSessionBindingEvent event)

銆銆褰撲綘鎵цSession.addAttribute(String,Object)鐨勬椂鍊欙紝濡傛灉浣犲凡緇忔妸涓涓疄鐜頒簡HttpSessionBindingListener鎺ュ彛鐨勭被鍔犲叆涓篈ttribute,Session浼氶氱煡浣犵殑綾伙紝璋冪敤浣犵殑valueBound鏂規硶銆傜浉鍙嶏紝Session.removeAttribute鏂規硶瀵瑰簲鐨勬槸valueUndound鏂規硶銆?/p>

public class HttpSessionBinding implements javax.servlet.http.HttpSessionBindingListener
{
銆ServletContext application = null;

銆public HttpSessionBinding(ServletContext application)
銆{
銆銆super();
銆銆if (application ==null)
銆銆銆throw new IllegalArgumentException("Null application is not accept.");
銆銆this.application = application;
銆}

銆public void valueBound(javax.servlet.http.HttpSessionBindingEvent e)
銆{
銆銆Vector activeSessions = (Vector) application.getAttribute("activeSessions");
銆銆if (activeSessions == null)
銆銆{
銆銆銆activeSessions = new Vector();
銆銆}

銆銆JDBCUser sessionUser = (JDBCUser)e.getSession().getAttribute("user");
銆銆if (sessionUser != null)
銆銆{
銆銆銆activeSessions.add(e.getSession());
銆銆}
銆銆application.setAttribute("activeSessions",activeSessions);
銆}

銆public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent e)
銆{
銆銆JDBCUser sessionUser = (JDBCUser)e.getSession().getAttribute("user");
銆銆if (sessionUser == null)
銆銆{
銆銆銆Vector activeSessions = (Vector) application.getAttribute("activeSessions");
銆銆銆if (activeSessions != null)
銆銆銆{
銆銆銆銆activeSessions.remove(e.getSession().getId());
銆銆銆銆application.setAttribute("activeSessions",activeSessions);
銆銆銆}
銆銆}
銆}
}

銆銆鍋囪鍏朵腑鐨凧DBCUser綾繪槸涓涓換鎰廢ser綾匯傚湪鎵ц鐢ㄦ埛鐧誨綍鏃訛紝鎶奤ser綾誨拰HttpSessionBinding綾婚兘鍔犲叆鍒癝ession涓幓銆?/p>

銆銆榪欐牱錛屾瘡嬈$敤鎴風櫥褰曞悗錛屽湪application涓殑attribute "activeSessions"榪欎釜vector涓兘浼氬鍔犱竴鏉¤褰曘傛瘡褰搒ession瓚呮椂錛寁alueUnbound琚Е鍙戯紝鍦ㄨ繖涓獀ector涓垹鍘誨皢瑕佽瓚呮椂鐨剆ession.
 
public void login()
throws ACLException,SQLException,IOException
{
銆/* get JDBC User Class */
銆if (user != null)
銆{
銆銆logout();
銆}
銆{
銆銆// if session time out, or user didn't login, save the target url temporary.

銆銆JDBCUserFactory uf = new JDBCUserFactory();

銆銆if ( (this.request.getParameter("userID")==null) || (this.request.getParameter("password")==null) )
銆銆{
銆銆銆throw new ACLException("Please input a valid userName and password.");
銆銆}

銆銆JDBCUser user = (JDBCUser) uf.UserLogin(
銆銆銆this.request.getParameter("userID"),
銆銆銆this.request.getParameter("password") );
銆銆銆user.touchLoginTime();
銆銆銆this.session.setAttribute("user",user);
銆銆銆this.session.setAttribute("BindingNotify",new HttpSessionBinding(application));
銆銆}
銆}

銆銆Login鐨勬椂鍊欙紝鎶奤ser鍜岃繖涓狟indingNotofy鐩殑鐨勭被閮藉姞鍏ュ埌session涓幓銆俵ogout鐨勬椂鍊欙紝灝辮涓誨姩鍦╝ctiveSessions榪欎釜vector涓垹鍘昏繖涓猻ession.

public void logout()
throws SQLException,ACLException
{
銆if (this.user == null && this.session.getAttribute("user")==null)
銆{
銆銆return;
銆}

銆Vector activeSessions = (Vector) this.application.getAttribute("activeSessions");
銆if (activeSessions != null)
銆{
銆銆activeSessions.remove(this.session);
銆銆application.setAttribute("activeSessions",activeSessions);
銆}

銆java.util.Enumeration e = this.session.getAttributeNames();

銆while (e.hasMoreElements())
銆{
銆銆String s = (String)e.nextElement();
銆銆this.session.removeAttribute(s);
銆}
銆this.user.touchLogoutTime();
銆this.user = null;
}

銆銆 榪欎袱涓嚱鏁頒綅浜庝竴涓狧ttpSessionManager綾諱腑.榪欎釜綾誨紩鐢ㄤ簡jsp閲岄潰鐨刟pplication鍏ㄥ眬瀵硅薄銆傝繖涓被鐨勫叾浠栦唬鐮佸拰鏈枃鏃犲叧涓旂浉褰撻暱錛屾垜灝變笉璐村嚭鏉ヤ簡銆?br>涓嬮潰鏉ョ湅鐪媕sp閲岄潰鎬庝箞鐢ㄣ?/p>

銆銆鍋囪涓涓櫥褰曠敤鐨勮〃鍗曡鎻愪氦鍒癲oLogin.jsp, 琛ㄥ崟涓寘鍚玌serName鍜宲assword鍩熴傝妭閫夐儴鍒嗙墖孌碉細

錛?
HttpSessionManager hsm = new HttpSessionManager(application,request,response);
try
{
銆hsm.login();
}
catch ( UserNotFoundException e)
{
銆response.sendRedirect("InsufficientPrivilege.jsp?detail=User%20does%20not%20exist.");
銆return;
}
catch ( InvalidPasswordException e2)
{
銆response.sendRedirect("InsufficientPrivilege.jsp?detail=Invalid%20Password");
銆return;
}
catch ( Exception e3)
{
銆%錛?Error:錛?=e3.toString() %錛烇紲br錛?br>銆Press 錛渁 href="login.jsp"錛濰ere錛?a錛?to relogin.
銆錛? return;
}
response.sendRedirect("index.jsp");
%錛?

銆銆鍐嶆潵鐪嬬湅鐜板湪鎴戜滑鎬庝箞寰楀埌涓涓綋鍓嶅湪綰跨殑鐢ㄦ埛鍒楄〃銆?/p>

錛渂ody bgcolor="#FFFFFF"錛?br>錛渢able cellspacing="0" cellpadding="0" width="100%"錛?/p>

錛渢r 錛?br>錛渢d style="width:24px"錛濻essionId
錛?td錛?br>錛渢d style="width:80px" 錛濽ser
錛?td錛?br>錛渢d style="width:80px" 錛濴ogin Time
錛?td錛?br>錛渢d style="width:80px" 錛濴ast access Time
錛?td錛?br>錛?tr錛?br>錛?
Vector activeSessions = (Vector) application.getAttribute("activeSessions");
if (activeSessions == null)
{
銆activeSessions = new Vector();
銆application.setAttribute("activeSessions",activeSessions);
}

Iterator it = activeSessions.iterator();
while (it.hasNext())
{
銆HttpSession sess = (HttpSession)it.next();
銆JDBCUser sessionUser = (JDBCUser)sess.getAttribute("user");
銆String userId = (sessionUser!=null)?sessionUser.getUserID():"None";
%錛?br>錛渢r錛?br>錛渢d nowrap=''錛烇紲%= sess.getId() %錛烇紲/td錛?br>錛渢d nowrap=''錛烇紲%= userId %錛烇紲/td錛?br>錛渢d nowrap=''錛?br>錛?= BeaconDate.getInstance( new java.util.Date(sess.getCreationTime())).getDateTimeString()%錛烇紲/td錛?br>錛渢d class="錛?= stl %錛?" nowrap=''錛?br>錛?= BeaconDate.getInstance( new java.util.Date(sess.getLastAccessedTime())).getDateTimeString()%錛烇紲/td錛?br>錛?tr錛?br>錛?
}
%錛?br>錛?table錛?br>錛?body錛?

銆銆浠ヤ笂鐨勪唬鐮佷粠application涓彇鍑篴ctiveSessions錛屽茍涓旀樉紺哄嚭鍏蜂綋鐨勬椂闂淬傚叾涓瑽eaconDate綾誨亣璁句負鏍煎紡鍖栨椂闂寸殑綾匯?/p>


銆銆榪欐牱錛屾垜浠緱鍒頒簡涓涓療鐪嬪湪綰跨敤鎴風殑鍒楄〃鐨勬鏋躲傝嚦浜庡湪綰跨敤鎴峰垪琛ㄥ垎欏電瓑鍔熻兘錛屼笌鏈枃鏃犲叧錛屼笉浜堣璁恒?/p>

銆銆榪欐槸涓涓潪鍒鋒柊妯″瀷鐨勪緥瀛愶紝渚濊禆浜巗ession鐨勮秴鏃舵満鍒躲傛垜鐨勫悓浜媠onymusic鎸囧嚭寰堝鏃跺欑敱浜庡悇涓巶鍟嗘濇兂鐨勪笉鍚岋紝榪欐湁鍙兘鏄笉鍙俊璧栫殑銆傝冭檻鍒拌繖縐嶉渶姹傦紝闇瑕佸湪姣忎釜鍙墮潰鍒鋒柊鐨勬椂鍊欓兘鍒ゆ柇褰撳墠鐢ㄦ埛璺濈涓婃浣跨敤鐨勬椂闂存槸鍚﹁秴榪囨煇涓涓瀹氭椂闂村箋傝繖瀹炶川涓婂氨鏄嚜宸卞疄鐜皊ession瓚呮椂銆傚鏋滈渶瑕佸疄鐜板埛鏂版ā鍨嬶紝灝卞繀欏諱嬌鐢ㄨ繖縐嶆瘡涓彾闈㈣繘琛屽埛鏂板垽鏂殑鏂規硶銆?/p>

鏈辮繙緲?Apusic鎶鏈敮鎸佸伐紼嬪笀 2007-07-02 11:31 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 亚洲国产精品无码av| 国产免费私拍一区二区三区| 久久久久亚洲AV成人无码| 亚洲黄片手机免费观看| 亚洲性日韩精品一区二区三区| 久久久免费观成人影院| 亚洲午夜精品第一区二区8050| ssswww日本免费网站片| 久久亚洲AV永久无码精品| 美女被免费网站91色| 亚洲av无码专区国产乱码在线观看| 97在线免费观看视频| 亚洲第一中文字幕| 91嫩草国产在线观看免费| 国产亚洲精品AAAA片APP| 亚洲国产成人乱码精品女人久久久不卡 | 亚洲AV日韩AV永久无码绿巨人 | 曰批全过程免费视频网址| 亚洲三级在线视频| 色视频色露露永久免费观看| 国产区图片区小说区亚洲区| 2048亚洲精品国产| 99久久免费中文字幕精品| 亚洲综合无码无在线观看| 又大又黄又粗又爽的免费视频 | 亚洲人成免费电影| 亚洲国产精品无码观看久久| 亚洲国产精品毛片av不卡在线| 国产色无码精品视频免费| 亚洲人成毛片线播放| 国产成人精品日本亚洲专区| 先锋影音资源片午夜在线观看视频免费播放 | 国产精品无码亚洲一区二区三区| 亚洲熟女乱综合一区二区| 久久免费精彩视频| 亚洲性无码一区二区三区| 国产aⅴ无码专区亚洲av麻豆 | 久久国产乱子伦精品免费看| 男人天堂2018亚洲男人天堂| 在线观看亚洲天天一三视| 亚洲网站在线免费观看|