JSP--9大隐式对象(内置对象)

  • 常见的是八大对象即:
    • 1.out
      JSPWriter out,将内容存到out缓冲区,最后在响应时拼接到response缓冲区中
       jsp中:
       text1 //out.write("text1\r\n");
       <%= "text2" %>//out.print("text2");
       <%
           out.write("text3");
           response.getWriter().write("text4");
        %>
      
      打印结果:

      text4 (response缓冲区)
      text1 (out缓冲区)
      text2 (out缓冲区)
      text3 (out缓冲区)

    • 2.request
      request对象
    • 3.response
      response对象
    • 4.config
      服务器config对象
    • 5.session
      session对象
    • 6.application
      即ServletContext
    • 7.page
      指当前页面转换后的Servlet类的实例
    • 8.pageContext
      类似ServletContext
      区别:
      1.可跨域对象储存
       pageContext.setAttribute(key,value,pageContext.enum);
        enum{
                     REQUEST_SCOPE
                     SESSION_SCOPE
                     ........
                 }
          request.getAttribute(key);
          session.getAttribute(key);
      

      2.pageContext.getObject()——获取任意8大隐式对象
      Object为对象名(request,response。。。。)


      JSP--9大隐式对象(内置对象)_第1张图片
      8个隐式对象

      第九种是错误页面才会生成的对象:exception
      在 isErrorPage 属性中为true时才会生成

你可能感兴趣的:(JSP--9大隐式对象(内置对象))