通过servletcontext读取WEB-INF下的配置文件

来源:互联网 发布:免费手机pdf编辑软件 编辑:程序博客网 时间:2024/06/01 10:22
InputStream is = request.getSession().getServletContext()
.getResourceAsStream("/WEB-INF/a.properties");
Properties properties = new Properties();
properties.load(is);

System.out.println(properties.getProperty("username"));

is.close();

0 0
原创粉丝点击