Cookie添加
Cookie的創(chuàng)建
Cookie cook = new Cookie("name","value");
任何頁面都能拿到?
application添加(servletContext)
后臺獲取this.getServletContext
賦值setAttribute
remove
replace
前臺獲取
EL里寫ApplicationScope.name
設(shè)置session有效期
通過java代碼設(shè)置
session.setMaxInactiveInterval(30*60);//以秒為單位,即在沒有活動30分鐘后公罕,session將失效
在工程的web.xml中設(shè)置
<session-config>
<session-timeout>15</session-timeout>
</session-config>
Cookie適合長時間保存內(nèi)容
session只要活動就會刷新時效
jsp:useBean? 封裝 導(dǎo)包
jsp:setProperty?
jsp:getProperty