JSP隐式对象
2017-10-19 14:22
169 查看
http://www.runoob.com/jsp/jsp-implicit-objects.html
实际上,我们可以到JSP编译后的servlet中去找,进入TOMCAT安装目录的work下:
/work/Catalina/localhost/contextPath/org/apache/jsp/WEB_002dINF/jsp/index_jsp.java
在其中找到_jspService方法:
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
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 {
response.setContentType("text/html; charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
......
request, response, pageContext, session, application, config, out, page, 再加一个exception,就是JSP九大隐式对象了。
其中 pageContext,request,session,application 就是我们所说的JSP四大域对象。
因为我们在JSP页面的<%....%>中写入的任何内容在最终编译后都会成为JSP对应的servlet类的_jspService()方法的一部分,所以这9个隐式对象无需在页面中声明就可以直接使用。
而<%!...%>中的内容则会成为JSP对应的servlet类的成员变量。
<%=...%>中的内容则会成为JSP对应的servlet类的_jspService()方法中out.println(...)的参数。
另外,还有EL的隐式对象与TAG文件的隐式对象,咱们以后说。
实际上,我们可以到JSP编译后的servlet中去找,进入TOMCAT安装目录的work下:
/work/Catalina/localhost/contextPath/org/apache/jsp/WEB_002dINF/jsp/index_jsp.java
在其中找到_jspService方法:
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
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 {
response.setContentType("text/html; charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
......
request, response, pageContext, session, application, config, out, page, 再加一个exception,就是JSP九大隐式对象了。
其中 pageContext,request,session,application 就是我们所说的JSP四大域对象。
因为我们在JSP页面的<%....%>中写入的任何内容在最终编译后都会成为JSP对应的servlet类的_jspService()方法的一部分,所以这9个隐式对象无需在页面中声明就可以直接使用。
而<%!...%>中的内容则会成为JSP对应的servlet类的成员变量。
<%=...%>中的内容则会成为JSP对应的servlet类的_jspService()方法中out.println(...)的参数。
另外,还有EL的隐式对象与TAG文件的隐式对象,咱们以后说。
相关文章推荐
- jsp隐式对象
- JSP运行原理和九大隐式对象
- JSP九大隐式对象
- JSP执行过程、隐式对象和错误机制
- javaweb之jsp之out隐式对象原理
- JSP的隐式对象
- jsp---隐式对象简单介绍
- Jsp隐式对象
- 记jsp隐式对象
- JSP九大隐式对象
- jsp中9大内置对象演示(内置对象又叫隐藏对象,隐含对象,隐式对象,9个内置对象全部为jsp保留字)
- 20160331javaweb之JSP include 指令&&九大隐式对象
- JSP教程四 JSP 隐式对象
- 【Java.Web】JSP —— 语法基础 —— 隐式对象implicit Objects
- javaweb-05-jsp九大隐式对象简介
- JSP-隐式对象
- JSP隐式对象
- jsp隐式对象
- JSP运行原理和九大隐式对象说明
- JSP的学习(6)——九大隐式对象及其out对象