Pagecontext,request,session,application of the scope of JSP

Source: Internet
Author: User

Scopes are used to bind data, properties                pagecontext page javax.servlet.jsp.PageContext pagecontext current page range,PageContext object cannot pass parameters to other pages

Request page jump javax.servlet.http.HttpServletRequest request
a request that ranges from one page to another page can be used in Request forwarding
session user javax.servlet.http.HttpSession session
scoped to a user, which fails when the user disconnects from the server, such as closing the browser
Application Global javax.servlet.ServletContext application
scope on server execution service to server shutdown service

Please note when applying1, request and session are based on the HTTP
2,servletcontext and application

same : In fact ServletContext and application are the same, it is equivalent to a class created two different names of variables. In

the ServletContext in the servlet is the Application object. All you have to do is open the JSP in the generated servlet after compilation

the _jspservice () method can see the following declaration:
           ServletContext application = null;

          < c29> application = Pagecontext.getservletcontext ();

Differences: The difference between the two is that application is used in JSPs and ServletContext is used in Servlets. Application and Page

the request session is a built-in object in the JSP, and the property data stored in the background with ServletContext can be

The application object is obtained.


Pagecontext,request,session,application of the scope of JSP

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.