PageContext中的常用方法及作用
这是从百度知道上复制过来的一些常用方法
此方法返回由匹配的 pushBody 方法保存的前一个 JspWriter“out”,并更新 PageContext 的“页”范围属性命名空间中 out 属性的值。
javax.servlet.jsp.PageContext中的所有方法及作用
1. void setAttribute( String name, Object value, int scope ) ;
void setAttribute( String name, Object value ) ;
在指定的共享范围内设置属性。
2. Object getAttribute( String name, int scope ) ;
Object getAttribute( String name ) ;
取得指定共享范围内以name为名字的属性值。
3. Object findAttribute( String name ) ;
按页面、请求、会话和应用程序共享范围搜索已命名的属性。
4. void removeAttribute( String name, int scope ) ;
void removeAttribute( String name ) ;
移除指定名称和共享范围的属性。
5. void forward( String url ) ;
将页面导航到指定的URL。
6. Enumeration getAttributeNamesScope( int scope ) ;
取得指定共享范围内的所有属性名称的集合。
7. int getAttributeScope( String name ) ;
取得指定属性的共享范围。
8. ErrorData getErrorDate() ;
取得页面的errorData对象。
9. Exception getException() ;
取得页面的exception对象。
10. ExpressionEvaluator getExpressionEvaluator() ;
取得页面的expressionEvaluator对象。
11. JspWriter getOut() ;
取得页面的out对象。
12. Object getPage() ;
取得页面的page对象。
13. ServletRequest getRequest() ;
取得页面的request对象。
14. ServletResponse getResponse() ;
取得页面的response对象。
15. ServletConfig getConfig() ;
取得页面的config对象。
16. ServletContext getServletContext() ;
取得页面的servletContext对象。
17. HttpSession getSession() ;
取得页面的session对象。
18. VariableResolver getVariableResolver() ;
取得页面的variableResolver对象。
19. void include( String url, boolean flush ) ;
void include( String url ) ;
包含其他的资源,并指定是否自动刷新。
20. void release() ;
重置pageContext内部状态,释放所有内部引用。
21. void initialize( Servlet servlet, ServletRequest request, ServletResponse response,
String errorPageURL, boolean needSession, int bufferSize, boolean autoFlush ) ;
初始化未经初始化的pageContext对象。
22. BodyContext pushBody() ;
BodyContext pushBody( Writer writer ) ;
保存当前的out对象,并更新pageContext中page范围内的out对象。
23. JspWrite popBody() ;
取出由pushBody()方法保存的out对象。
24. void handlePageException( Exception e ) ;
void handlePageException( Thrwoable t ) ;