servlet notation:ImportJava.util.HashMap;ImportJava.util.Map;ImportJavax.servlet.ServletContext;Importjavax.servlet.ServletException;ImportJavax.servlet.http.HttpServlet; Public classInitsystemvariableservletextendsHttpServlet {PrivateServletContext ServletContext; PrivateMap<string, object> allmap=NewHashmap<string, object>(); @Override Public voidInit ()throwsservletexception {ServletContext=Super. Getservletcontext ();//the global applicationAllmap.put ("Systemtitle", "Backend management system"); Allmap.put ("SystemName", "Educational Administration system"); //as long as the page is used to addServletcontext.setattribute ("Basemap", Allmap); }}web.xml Configuration:<servlet> <servlet-name>BaseApplication</servlet-name> <servlet-class>com.wisezone.controller.initsystemvariableservlet</servlet-class> <load-on-startup>3</load-on-startup></servlet>The value is evaluated directly with the EL Expression:<title>${basemap["Systemtitle"]}</title>freemarker numbers more than 3 digits will be formatted and canceled for formatting purposes:<input type= "text" value= "${salary?string (' #.00 ')}" name= "Salary"/>
JSP page Global Variables for note _java