如后端有个叫做config.properties的配置文件:
sys.img=st_sp
jsp中引用的方式是:
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <% String CONTEXT_PATH = request.getContextPath(); ResourceBundle res = ResourceBundle.getBundle("config"); String t = res.getString("sys.img"); String tab_title=new String(t.getBytes("ISO8859-1"),"utf-8"); %> <!doctype html> <html> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="renderer" content="webkit"> <title> <%=tab_title%> </title> </head> <body> <div id="app"></div> </body> </html>
这样就可以获取到配置文件里面对应的配置