JSP built-in object, jsp built-in

Source: Internet
Author: User

JSP built-in object, jsp built-in

In JSP, nine built-in objects are provided to simplify user development. These built-in objects are instantiated by containers for users and can be directly used by users instead of in Java, you must use the new keyword to instantiate an object before using it.

Nine built-in objects in JSP
No. Built-in object Type Description
1 PageContext Javax. servlet. jsp. PageContext JSP page container
2 Request Javax. servlet. http. HttpServletRequest Obtain user request information
3 Response Javax. servlet. http. HttpServletResponse Response Information from the server to the client
4 Session Javax. servlet. http. HttpSession Used to save information of each user
5 Application Javax. servlet. ServletContext Indicates the shared information of all users.
6 Config Javax. servlet. ServletConfig Server configuration to obtain initialization parameters
7 Out Javax. servlet. jsp. JspWriter Page output
8 Page Java. lang. Object Indicates a Servlet instance displayed from this page.
9 Exception Java. lang. Throwable Indicates the exception on the JSP page, which takes effect only on the error page.

Among the nine built-in objects above, pageContext, request, response, session, and application are commonly used.

The storage range of four attributes is provided in JSP. The attribute storage range refers to the number of pages on which a built-in object can be saved and used.

  • Page: only save attributes on one page. It is invalid after redirect.
  • Request: it is saved in only one request, and is still valid after server jump.
  • Session: in the range of a session, no matter what type of Jump can be used, but the new browser cannot be used.
  • Application: it is saved on the entire server and can be used by all users.

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.