pageContext对象
pageContext对象提供了对JSP页面内所有的对象及名字空间的访问
pageContext对象可以访问到本页所在的session,也可以取本页页面所在的application的某一个属性值
pageContext对象相当于页面中所有功能的集大成者
pageContext对象的本类名也叫pageContext
常用方法如下:
JspWriter getOut() | 返回当前客户端相应被使用的JspWriter流(out) |
HttpSession getSession() | 返回当前页中的HttpSession对象(session) |
Object getPage() | 返回当前页的Object对象(page) |
ServletRequest getRequest() | 返回当前页的ServletRequest对象(request) |
ServletResponse getResponse() | 返回当前页的ServletResponset对象(response) |
void setAttribute(String name,Object attribute) | 设置属性及属性值 |
Object getAttribute(String name,int scope) | 在指定范围内取属性的值 |
int getAttributesScope(String name) | 返回某属性的作用范围 |
void forward(String relativeUrlPath) |
使当前页面跳转到另一页面,地址栏上地址不发生变化 |
void include (String relativeUrlPath) | 在当前位置包含另一个文件 |