Httpsession
sessionId:<%= session.getId() %>一、session介紹:
此處省略。。。
二、session生命週期:
1)創建一個Session對象;
首次訪問WEB頁面時創建個Session;
2)銷燬一個Session對象;
1.程序調用HttpSession.invalidate();
2.超過Session最大有效時間;
3.服務器進程被停止;
注意;關閉瀏覽器智慧使存在客戶端瀏覽器內存中的Session cookie失效,不會使服務器的Session對象失效;
三、session相關用法:
1)獲取Session對象:request.getSession();
2)屬性相關的:setAttribute,getAttribute,removeAttribute;
3)使Session失效的方法:invalidate()方法;
4)設置其最大時效:setMaxinactiveInterval;
sessionIsNew:<%= session.isNew() %>
sessionCreatetime:<%= session.getCreationTime() %>
sessionLastAccessedtime:<%= session.getLastAccessedTime() %>
sessionMaxInactive:<%= session.getMaxInactiveInterval()%>
四、URL重寫:
1)將會話標識號以參數的形式附加在超鏈接的URL地址後面的技術稱爲URL重寫。
2)使用方法:<a href="<%=response.encodeURL("login.jsp")%>">重新登錄</a>