Four Scopes of DRP-Web development and four drp-web development

Source: Internet
Author: User

Four Scopes of DRP-Web development and four drp-web development

Looking at DRP recently, Wang Yong talked about the four areas of web development, reading materials, and sharing his feelings with you. There are also similarities between ASP. NET videos that have been learned before!

I. Brief Introduction:

Page (jsp valid) request (one request) session (one session) application (current web application) page domain refers to pageContext .; the request domain refers to requestHttpServletRequest; the session domain refers to sessionHTTPSession; the application domain refers to applicationServletContext.
They are domain objects because they all have built-in map sets and both have the setAttribute getAttribute method. They all have their own fixed lifecycles and scopes. The lifecycle of these four objects (the lifecycle is the period from creation to destruction of the Value Object ):
The lifecycle of the four domain objects:
Page: the jsp page is executed, the lifecycle starts, the jsp page is executed, and the declaration cycle ends.
Request: the user sends a request, starts, the server returns a response, the request ends, and the lifecycle ends.
Session: the user opens the browser to access the object, creates a session (start), the session times out or is declared invalid, and the object lifecycle ends.

Application: created when a web application is loaded. The Web application is removed, the server is shut down, and the object is destroyed. [End].

2. Note:

The Page is valid only in the current jsp, and each request corresponds to different requests. The Request is valid only in the current request, and each request corresponds to different Request domains. The Session is valid only in one Session, when the session ends, data cannot be obtained. When four domain objects are selected, a small range of objects is used. page: The data is only a set temporarily, use page (custom map of the page) to use it elsewhere on the jsp page ).
 
Request: The data is only displayed, and it is useless after reading it. The processing result (data) generated by the Servlet is displayed to the jsp. Data Forwarding can contain data.
 
Session.
The user logs on and sends the user information to the client. After reading the information, visit other pages and view the user information.
Shopping Cart. The shopping cart is successful. You can view the shopping cart later.
Request redirection, because it is two requests, the data of each request, the second request also needs to be viewed.
 
Application: The data is used up for a user.
Chat rooms and chat records must be viewed by all users.
Count the number of online users on the website. All users can see one number.
Iii. Summary:
When selecting four domain objects, you can use a smaller range to avoid a large range. When Map needs to be defined, it is better to use page, request Servlet, forward the data to the jsp to save the request, redirect the data stored in the Session with the past, and store the global data in the application. the DRP video is the most detailed one I have ever seen, and the seriousness of instructor Wang has deeply infected myself.

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.