


Understand the number of built-in objects in JSP. Are you familiar with how many there are?
Number of JSP built-in objects: 9
Specific code examples:
<%@ page import="javax.servlet.http.*" %> <% // 获取请求对象 HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); // 获取响应对象 HttpServletResponse response = (HttpServletResponse) pageContext.getResponse(); // 获取会话对象 HttpSession session = request.getSession(); // 获取上下文对象 ServletContext application = pageContext.getServletContext(); // 获取配置对象 ServletConfig config = pageContext.getServletConfig(); // 获取页面对象 PageContext pageContext = this.pageContext; // 获取异常对象 Throwable exception = (Throwable) pageContext.getAttribute("javax.servlet.error.exception"); // 获取输出对象 JspWriter out = pageContext.getOut(); // 获取错误码对象 Integer statusCode = (Integer) pageContext.getAttribute("javax.servlet.error.status_code"); %>
1. request
The request object represents the client's request, which contains information about the request, such as request method, request header, request parameters, request body, etc.
2. response
The response object represents the server's response. It contains information about the response, such as response status code, response header, response body, etc.
3. session
The session object represents the session between the client and the server. It contains information about the session, such as session ID, session attributes, and session timeout. wait.
4. application
The application object represents the context of the Web application. It contains information about the application, such as the root path of the application and the configuration information of the application. , application resources, etc.
5. config
The config object represents the configuration information of the Servlet. It contains information about the Servlet, such as the name of the Servlet, the class name of the Servlet, and the initialization parameters of the Servlet. wait.
6. pageContext
The pageContext object represents the context of the JSP page. It contains information about the JSP page, such as the request object, response object, session object, Context objects, configuration objects, etc.
7. exception
The exception object represents the exception that occurs in the JSP page. It contains information about the exception, such as the type of exception, the message of the exception, and the stack of the exception. Tracking etc.
8. out
out object represents the output stream of the JSP page, which can be used to output content to the client, such as HTML code, text, pictures, etc.
9. statusCode
The statusCode object represents the error code that occurred in the JSP page. It contains information about the error code, such as the number of the error code and the description of the error code. wait.
The above is the detailed content of Understand the number of built-in objects in JSP. Are you familiar with how many there are?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Discussing the hierarchical architecture problem in back-end development. In back-end development, common hierarchical architectures include controller, service and dao...

How to use OAuth2.0's access_token to achieve control of interface access permissions? In the application of OAuth2.0, how to ensure that the...

Discussing the hierarchical architecture in back-end development. In back-end development, hierarchical architecture is a common design pattern, usually including controller, service and dao three layers...

Questions and Answers about constant acquisition in Java Remote Debugging When using Java for remote debugging, many developers may encounter some difficult phenomena. It...

How to convert names to numbers to implement sorting within groups? When sorting users in groups, it is often necessary to convert the user's name into numbers so that it can be different...

Confused with choosing Java project management tools for beginners. For those who are just beginning to learn backend development, choosing the right project management tools is crucial...

Analysis of class loading behavior of SPI mechanism when Tomcat loads Spring-Web modules. Tomcat is used to discover and use the Servle provided by Spring-Web when loading Spring-Web modules...

Regarding the analysis method of IntelliJIDEA cracking in the programming world, IntelliJ...
