ServletContext getServletContext( ) 回传目前此网页的执行环境(context),例如:application HttpSession getSession( ) 回传和目前网页有联系的会话(session),例如:session 3.PageContext对象提供取得属性的方法 Object getAttribute(String name, int scope) 回传name 属性,范围为scope的属性对象,回传类型为Object Enumeration getAttributeNamesInScope(int scope) 回传所有属性范围为scope 的属性名称,回传类型为Enumeration int getAttributesScope(String name) 回传属性名称为name 的属性范围 void removeAttribute(String name) 移除属性名称为name 的属性对象 void removeAttribute(String name, int scope) 移除属性名称为name,范围为scope 的属性对象 void setAttribute(String name, Object value, int scope) 指定属性对象的名称为name、值为value、范围为scope Object findAttribute(String name) 寻找在所有范围中属性名称为name 的属性对象
九、exception对象
若要使用exception 对象时,必须在page 指令中设定。<%@ page isErrorPage="true" %>才能使用。 exception提供的三个方法: getMessage( ) getLocalizedMessage( )、 printStackTrace(new java.io.PrintWriter(out))
(出处:清风网络学院)
上一篇:<jsp-config>标签使用详解
下一篇:JSP与MySQL交互的中文乱码解决方案
|