pageContext对象
来源:互联网 发布:手机端淘宝店招怎么做 编辑:程序博客网 时间:2024/05/29 17:00
pageContext对象可操作request、response、session、out等对象中的数据,需要使用它们的相应对象进行操作
pageContext对象提供了对JSP页面所有的对象及命名空间的访问
getRequest() 用于返回当前的request对象
getResponse() 用于返回当前的response对象
getSession() 用于返回当前的session对象
getOut() 用于反悔当前页面的out对象
getException() 用于返回当前的exception对象
getServletContext() 用于返回当前页面的application对象
findAttribute(String name) 用于按照页面、请求、会话以及应用程序范围的顺序实现对某个已命名属性的搜索,返回其属性值或null
forward(String relativeUrlPath) 用于把页面重新定向到另一个页面或者Servlet组件上
moveAttribute(String name) 用于删除默认页面范围或特定对象范围之中的已命名对象
release() 用于释放pageContext所占资源
include(String relativeUrlPath) 用于在当前位置包含另一文件
setAttribute(String name, Object attribute) 用于设置指定属性及属性值
setAttribute(String name, Object obj, int scope) 用于在指定范围内设置指定属性及值
getAttribute(String name, int scope) 用于在指定范围内获取指定属性的值
getAttribute(String name) 用于获取指定属性的值
实例:
request.setAttribute("name", "yhc"); session.setAttribute("name", "yhc"); application.setAttribute("name", "yhc"); request对象中的值<%=pageContext.getRequest().getAttribute("name")%> session application <%=pageContext.getServletContext().getAttribute("name")%>
- pageContext对象
- pageContext对象
- pageContext对象
- pageContext对象
- pageContext对象
- pageContext对象
- PageContext对象
- pageContext对象
- pageContext对象
- pageContext对象
- pageContext对象
- pageContext对象
- pageContext对象
- pageContext对象
- pageContext对象
- pageContext对象
- pageContext对象
- pageContext对象
- HTML5 META标签 标准写法
- Servlet学习和汇总
- 百万数据查询优化
- 如何向外行解释产品经理频繁更改需求为什么会令程序员烦恼?
- poj2983Is the Information Reliable?——差分约束
- pageContext对象
- kernel boot的时候如何抓取dtsi
- mfc移植过程中丢失MSVCP100D.dll解决方法
- 常见的HTTP请求头与响应头
- Linux之awk
- Web项目同时使用Struts2和SpringMVC
- Redkale 技术详解 01 -- 双亲委托模型
- JSP脚本中的9个内置对象
- MySql查询根据年份或月份查询