2020-12-14
设置每个对象
String str="2000元";
//把数据完成共享
pageContext.setAttribute("page", str);
request.setAttribute("request", str);
session.setAttribute("session", str);
application.setAttribute("application", str);
这个时候所有对象都能得到str
当离开本页面的时候,比如转发
request.getRequestDispatcher("其他页面.jsp").forward(request,response);
时,page就不能获得str,也就是超出了page对象的作用域
当页面进行了重定向
response.sendRedirect("其他页面.jsp");
时,request也不能获取str,原因同上
当页面更换用户使用时,例如更换浏览器,session便不能获取str
当服务器重启时,application不能获取str