Introduction to four major jsp scopes and four major jsp scopes
Four Scopes
In Web applications, JSP-created objects have a certain lifecycle and may be accessed by other components or objects. The object declaration cycle and accessibility are called scopes. The scope of the four range objects ranges from small to large: pageContext ---- request ---- session ---- application.
(1) pageContext: Page domain
The page scope is limited to the current page object. It can be similar to this object of java. If you leave the current JSP page (whether redirect or forward), all attribute values in pageContext will be lost.
(2) request: request domain
The request scope is within the same request. During page Jump, if you use the forward method to redirect, the forward target page can still get the attribute value in the request. If a page is redirected through redirect, because redirect is equivalent to sending a new request, the attribute values in the request will be lost in this scenario.
(3) session: session domain
The session scope is within the life cycle of a session. If the session fails, the data in the session is also lost.
(4) application: application domain
The application scope is the largest. As long as the server does not stop, the application object always exists and is shared by all sessions.