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 ) ;

转载于:https://www.cnblogs.com/DynamicAnt/archive/2012/08/24/2653666.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值