, page attribute scope (pageContext)
a. Attributes set on one page cannot be accessed when jumping to other pages (including redirection and).
Example: pageScopeDemo01.jsp
//Attributes set at this time Can only be obtained on this page
pageContext.setAttribute("name","League of Legends");//Set attributes
pageContext.setAttribute("date",new Date()); //Set attributes
/ /Note: The names of the two attributes set here are name and date. These two are string type data, but the corresponding attribute values League of Legends and new Date are not string types, but two Object type data.
%>
//Get the set attribute
String refName = (String)pageContext.getAttribute("name");
Since the value obtained is of Object type, String coercion must be used Downcast to String type
Date refDate = (Date)pageContext.getAttribute("date");
2. Request attribute range
a. The request attribute range means that it is valid in a server jump. As long as the server jumps (forwarding or dispatching), the set request attribute can be passed on.a. The attributes set by session can be obtained no matter how you jump. Of course, session is only for one user
b. After jumping (server jump/client jump) to other pages, the attributes set on the first page can still be obtained by other pages. properties.
c. Whether it is a client-side jump or a server-side jump, you can access the session attribute set on the first page, but the condition is that it is only limited to the current user. If a new browser is opened at this time, the session attribute value cannot be accessed.
4. Application attribute scope
a. The application attribute scope is an attribute set on the server, so once set, any user can browse to this attribute.
b. If you shut down the Tomcat server and then restart it, open a browser window and run it, and directly get the value set by the application attribute, you will not be able to get it.