preface
In the lebyte open class, the teacher classified the role of JSP for us
JSP’s four scopes are:
Page, Request, Session, application.
★ The first scope is page, which is only valid for the current page, i.e. the page requested by the user.
Page is only valid for the current page, that is, the page requested by the user. When the current page is closed or moved to another page, the page object is released after the response is returned to the client.
★ The second scope is request, which is valid in the current request.
Request can use setAttribute() to transfer information in a page, or forward() to jump between pages. It is important to note that request forwarding is not redirection, and forwarding is transparent to the browser, that is, no matter how the page is redirected, The address bar still shows the original address.
★ The third scope is session, which is valid for the current reply.
When the same browser on a computer makes multiple visits to the server, the information passed between those visits is the scope of the session scope. The default Tomcat time is 120 minutes. SetMaxInactiveInterval (int) can also be set using setMaxInactiveInterval(int). Or force the current session to end with the invalidate() method.
★ The fourth scope is application, which is valid for all applications, from the start of the server to the end of the server.
All data stored in the application scope is valid and can also be assigned by setAttribute or getAttribute.
The article is from Lebyte