在服务器上存储信息的方式


在服务器上存储信息的方式,四大范围对象
page/pageContext
一个页面
request
一次请求
前台发送的请求信息
setAttribute()
session
一次会话,对应的是浏览器,
setAttribute();
getAttribute();
inValidate(); 设置session失效
getMaxInActiveInterval()
awrMaxInActiveInterval(int s); 单位是秒
getId(); 获取session的唯一标识

application:代表整个应用,服务器启动时,创建对,服务器终止时,销毁该对象
getServletContext();

setAttribute();
getAttribute();
getRealPath(); 获取真实路径

原文地址:https://www.cnblogs.com/longmo666/p/13468078.html