zoukankan      html  css  js  c++  java
  • 描述JSP的9大内置对象(不重要)

    首先,对于我们现在来说,用JSP的内置对象来直接开发的基本没有了,除非是比较老旧的项目,jsp的内置对象,则是不需要在jsp页面中创建,直接可以使用。

    其实,我们通过观察jsp生成的java文件可以发现,其背后是帮我们创建了这些对象,所以对象的创建方式还是没有改变的。

    我们去观察背后生成java类,那么里面是有给各个对象创建及初始化的代码(截取部分代码片段)

    public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
    
    
    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 (HttpServletRequest)
    response (HttpServletResponse)
    config (ServletConfig)
    application (ServletContext)
    session (HttpSession)
    exception (Throwable)
    page (Object(this))
    out (JspWriter)
    pageContext (PageContext)

  • 相关阅读:
    Java关键字:transient,strictfp和volatile简介
    freemarker 数字格式化函数
    使用 BeanCopier 复制对象
    扩展Smack Message
    JavaScript 中2个等号与3个等号的区别
    Eclipse 3.5使用dropins的插件安装方式
    常见的HTTP 状态代码
    使用python操作FTP上传和下载
    Python操作redis
    Ubuntu14.04安装redis和简单配置
  • 原文地址:https://www.cnblogs.com/MJyc/p/13953819.html
Copyright © 2011-2022 走看看