Equest is an object that encapsulates the request data and properties submitted by the client side (that is, by the user through browser).
Response is an object that encapsulates Web server-side response data and properties.
We often confuse PageContext, request, session, and application because they can both set or read properties through SetAttribute () and getattribute (). But there is something else between them, and their biggest difference is the scope of use.
The scope of the PageContext object applies only to the current page range, which means that more than this page can be used. Therefore, it is not possible to use the PageContext object to pass parameters to other pages.
The scope of the request object is when a JSP Web page makes a request to another JSP Web page, and then this property is invalidated.
The session is scoped to the length of time a user continues to connect to the server, but this property is invalid when disconnected from the server. such as breaking the net or closing the browser.
The scope of the application executes the service at the beginning of the server, until the server shuts down. It has the largest range and the longest life cycle.
Session Main function: Verify whether the user is logged in. Can be obtained on several pages.
Request: Only <jsp:forward page= "" > Jump page can be obtained.
Application: Once set, all page windows can get the data.
Application session request-> All need to span multiple pages
Setting too many application or saving too many objects per session degrades performance
If you can use the request, do not use the session can use the session do not use application
Application application: Online personnel statistics, online personnel list
PageContext: The Save scope of a page by default
In fact, four attribute ranges are done through the PageContext property.
Pagecontext.setattribute ("name", "Mldn", Pagecontext.request _scope), change the name of the Scarlet Letter to get.
On another page, use request to receive string Name= (string) request.getattribute ("name");<%=name%>;
To restart the server if you want to free application resources
The four attribute ranges are based on PageContext, but in development, the session and request range are often used.
Pagecontext,request,session,application life cycle