06-08
11

JSP里的内建对象 和他们工厂方法

http://huac.blogbus.com/files/1155284786.jpg

生命周期及实现接口:

     同WEB服务器初始化开始到结束。他们分别是:applilation,对应ServletContext类;config,对应ServletConfig类;pageContext对应PageContetxt类。

     从用户登陆开始,到页面关闭的是session对象,对应HttpSession类。

     一个页面到另一个页面结束。request,对应HttpServletRequest类;response对应HttpServletResponse类。

     另外,out对象即为输出流。对应类为JSPWriter类。

————————工厂方法——————————————

    ……
    JspFactory _jspxFactory = null;  //声明
    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      _jspxFactory = JspFactory.getDefaultFactory();//用方法获取
      response.setContentType("text/html");
      pageContext = _jspxFactory.getPageContext(this, request, response,  //生产pageContext
         null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();  //生产application
      config = pageContext.getServletConfig();  //生产config
      session = pageContext.getSession();  //生产session
      out = pageContext.getOut();   //生产out
      _jspx_out = out;

      ……



文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags: 工厂方法 内建对象 JSP
相关日志:
评论: 0 | 引用: 0 | 查看次数: 685
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 1000 字 | UBB代码 开启 | [img]标签 关闭