JSP:JSP的九大内置对象

来源:互联网 发布:西云数据 光环新网 编辑:程序博客网 时间:2024/05/18 01:52
九个内置对象

* out --> jsp的输出流,用来向客户端响应
* page --> 当前jsp对象! 它的引用类型是Object,即真身中有如下代码:Object page = this;
* config --> 它对应真身中的ServletConfig对象!
* pageContext --> 一个顶9个!
* request --> HttpServletRequest
* response --> HttpServletResponse
* exception --> Throwable只有在错误页面中可以使用这个对象,在jsp的page指令中有个属性iserrorpage
* session -->HttpSession类的对象,不是每个JSP页面中都可以使用,如果在某个JSP页面中设置<%@page session=”false”%>,说明这个页面不能使用session。
* application --> ServletContext

 pageContext
  * Servlet中有三大域(request、session、application),而JSP中有四大域,它就是最后一个域对象!
    > ServletContext:整个应用程序
    > session:整个会话(一个会话中只有一个用户)
    > request:一个请求链!
    > pageContext:一个jsp页面!这个域是在当前jsp页面和当前jsp页面中使用的标签之间共享数据!
      > 域对象
      > 代理其他域:pageContext.setAttribute("xxx", "XXX", PageContext.SESSION_SCOPE);
      > 全域查找:pageContext.findAttribute("xxx");从小到大,依赖查找!
      > 获取其他8个内置对象:
0 0
原创粉丝点击