pageContext.setAttribute用法
来源:互联网 发布:呼死你淘宝搜索什么 编辑:程序博客网 时间:2024/06/07 17:44
Servlet作用域从小到大是这样排列的,page,request,session,pageContext。page只是作用于当前请求的页面request是一次请求,根据HTTP无状态,所以可以知道每一次请求对象是不同的。session是一次会话,比如有些网站需要登录后才能查看资源,从登录到你关闭浏览器后,这就是一次会话,session是存在服务端的。还有一种情况,有时你在一个网页上长时间没操作,再操作会让你重新登录,这也是session的问题,服务器那边设置了session失效的时间。pageContext是在整个Web应用上都是有效的,可以理解为所有的网页,因为这个对象是常常用来共享资源的,也就是用户1提交了一个资源,放到了pageContext作用域中,其它用户也可以看到这个资源。
就好比我在jsp页面中想在session里面获取一个对象要放到pageContext里面
<% Object roleCode = session.getAttribute("roleCode"); pageContext.setAttribute("roleCode",roleCode); %>
然后其他的页面通过${roleCode}获取这个值
0 0
- pageContext.setAttribute用法
- pageContext 用法
- getAttribute,setAttribute用法示例
- setAttribute的用法
- request.setAttribute的用法
- JavaScript中setAttribute用法
- setAttribute的具体用法
- JavaScript中setAttribute用法
- getAttribute 与 setAttribute 用法
- setAttribute的具体用法
- JavaScript中setAttribute用法
- setAttribute的具体用法
- QT中的setAttribute()用法
- request.setAttribute()的用法
- request.setAttribute()用法
- javascript setAttribute()用法
- request.setAttribute的用法
- setAttribute的具体用法
- 第六十七篇:opencv中KeyPoint与point2f之间相互转换
- 笔记本更换cpu、换硅脂后电脑开机失败
- 设计模式-行为设计模式:迭代器模式 Iterator
- 修改init.qcom.rc文件不生效
- 第六章 PL/SQL编程
- pageContext.setAttribute用法
- IOS-遍历文件夹下面的所有文件名
- 7.4 Swift原始值fromRaw方法
- listview嵌套listview,子listview中有换行的textview展示有问题,肿么办?
- 多线程的简单应用
- bzoj3994【莫比乌斯函数】
- linux下建立链接
- 第七章 事务、过程、触发器
- Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable