1.在resources目录下创建db.properties文件
2.build后生成db.properties文件
3.测试代码
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
InputStream is = this.getServletContext().getResourceAsStream("/WEB-INF/classes/com/chengwei/servlet/aa.properties");
Properties prob = new Properties();
prob.load(is);
String user = prob.getProperty("username");
String pwd = prob.getProperty("password");
resp.getWriter().print(user+":"+pwd);
}