Overview of jsp built-in objects

Source: Internet
Author: User

Overview of JSP built-in objects

(1) Request object of the HttpServletRequest class
Role: indicates the request object. It is mainly used to receive data transmitted from the client to the server over HTTP.
(2) Respone object of the HttpServletResponse class
Role: indicates the response object, which is mainly used to send data to the client.
(3) out object of the JspWriter class
Role: Mainly used to output data to the client;
The base class of Out is JspWriter.
(4) session Object of the HttpSession class
Purpose: stores the information of each user separately and the session associated with the request;
Session status maintenance is a must for Web application developers.
(5) application Object of the ServletContex class
Role: it is mainly used to save user information and the runtime environment of code snippets;
It is a shared built-in object, that is, multiple users in a container share an application object, so the stored information is shared by all users.
(6) PageContext object of the PageContext class
Purpose: Manage webpage attributes, wrap the context of the JSP page, and manage access to named objects in special visible parts of JSP, it is created and initialized by the container.
(7) Config object of the ServletConfig class
Purpose: The code snippet configuration object, indicating the Servlet configuration.
(8) Object-class Page (equivalent to this) Object
Purpose: Process JSP web pages. It is an instance of the Object class and refers to an instance of the JSP implementation class. That is, it is also the JSP itself and is valid only within the JSP page range.
(9) Exception
Purpose: handle errors and exceptions when executing JSP files
It can only be used on the error page, provided that the isErrorPage = true page must be included in the page command;
For example, a. jsp: <% @ page contentType = "text/html; charset = gb2312" errorPage = "error. jsp" %>
Error. jsp: <% @ page contentType = "text/html; charset = gb2312" isErrorPage = "true" %>
Then, you can use the exception built-in object on the error. jsp page. The usage is as follows:
<% = Exception. getMessage () %>

Note: attributes in pageContext are shared on the current page by default;
The attributes in the session are shared in the current session;
The owner of the ServletContext object is shared to all pages;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.