If you want to set a property that can be seen by all users, you can set the property scope to application so that the property can be saved on the server.
Here is a small example to verify:
(1) application_demo.jsp
1<%@ page contenttype= "text/html; Charset=utf-8 "Language=" Java "Import= "java.util.*" errorpage= ""%>2<!doctype html>345<meta charset= "Utf-8" >6<title>application Attribute Range </title>78 9<body>Ten<% OneApplication.setattribute ("name", "Lisi"); AApplication.setattribute ("Birthday",NewDate ()); -%> -<a href= "application_demo2.jsp" > Get Properties by Hyperlink </a> the</body> -
(2) application_demo2.jsp
1<%@ page contenttype= "text/html; Charset=utf-8 "Language=" Java "Import= "java.util.*" errorpage= ""%>2<!doctype html>345<meta charset= "Utf-8" >6<title>application Attribute Range </title>78 9<body>Ten<% OneString Name= (String) application.getattribute ("name"); ADate birthday= (date) application.getattribute ("Birthday"); -%> - the -</body> -
Browser display: (At this point we open two different browsers)
Note: Too many property settings in the application range can affect server performance.
JSP_ Attribute Range _application