标签:https imp oid ase load hash ring eem obj
servlet写法: import java.util.HashMap; import java.util.Map; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; public class InitSystemVariableServlet extends HttpServlet { private ServletContext servletContext; private Map<String, Object> allMap=new HashMap<String, Object>(); @Override public void init() throws ServletException { servletContext= super.getServletContext(); //全局的application allMap.put("systemTitle", "后台管理系统"); allMap.put("systemName", "教务管理系统"); //只要是页面用的往里面加 servletContext.setAttribute("baseMap", allMap); } } web.xml配置: <servlet> <servlet-name>BaseApplication</servlet-name> <servlet-class>com.wisezone.controller.InitSystemVariableServlet</servlet-class> <load-on-startup>3</load-on-startup> </servlet> 取值直接用el表达式: <title>${baseMap["systemTitle"] }</title> Freemarker数字超过3位会格式化,取消格式化用: <input type="text" value="${salary?string(‘#.00‘)}" name="salary" />
标签:https imp oid ase load hash ring eem obj
原文地址:http://www.cnblogs.com/by-1642146903/p/7860156.html