JSP内置对象
2023-09-11 14:18:04 时间
JSP在进行编译的时候动态的创建了很多的内置对象,那么如果开发者知道,可以直接在JSP页面中使用这些对象。我们将这些内置的对象称之为JSP内置九大对象。
如果需要将以下的九大内置对象直接获取出来,那么可以这样做:
编写一个错误处理页面,那么请求查看翻译好的jsp文件。
1 public void _jspService(HttpServletRequest request, HttpServletResponse response) 2 throws java.io.IOException, ServletException { 3 PageContext pageContext = null; 4 HttpSession session = null; 5 Throwable exception = org.apache.jasper.runtime.JspRuntimeLibrary.getThrowable(request); 6 if (exception != null) { 7 response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); 8 } 9 ServletContext application = null; 10 ServletConfig config = null; 11 JspWriter out = null; 12 Object page = this; 13 JspWriter _jspx_out = null; 14 PageContext _jspx_page_context = null; 15 ...... 16 }
因为在JSP中编写JSP脚本以及JSP输出表达式都会默认翻译在_jspService()那么以上该方法中定义的九大对象开发者可以任意使用。
JSP九大对象 |
Servlet类型 |
request |
HttpServletRequest |
response |
HttpServletResponse |
session |
HttpSession |
config |
ServletConfig |
application |
ServletContext |
out |
JspWriter |
page |
Object |
pageContext |
PageContext |
exception |
Throwable |
相关文章
- javaWeb学习总结(8)- JSP属性范围(5)
- JSP EL表达式
- 【JAVA】JSP中通过Get和Post方式传递页面参数(三种方式)。
- 《JSP+Servlet+Tomcat应用开发从零開始学》
- jsp内置对象作业3-application用户注册
- jsp内置对象作业2-留言簿
- sao/jsp
- tomcat启动后,页面浏览时报错 Unable to compile class for JSP的解决方案
- ajax 异步 通信 小例子 servlet与 jsp异步 get
- The JSP specification requires that an attribute name is preceded by whitespace
- JSP文件下载及出现getOutputStream() has already been called for this response的解决方法
- JSP 九大隐式对象
- jsp param动作标签
- 关于Jsp中的三种弹框
- JSP基础--JAVA遇见HTML
- java或者jsp中修复会话标识未更新漏洞
- @Java web程序员,在保留现场,服务不重启的情况下,执行我们的调试代码(JSP 方式)