自己已经搞定,在servlet里面读取这个文件的 String rootpath =getServletContext().getRealPath("/"); if (rootpath != null) { rootpath = rootpath.replaceAll("\\\\", "/"); } else { rootpath = "/"; } if (!rootpath.endsWith("/")) { rootpath = rootpath + "/"; } Properties prop = null; try { prop = new Properties(); prop.load(new FileInputStream(rootpath + "WEB-INF/init.properties")); } catch (IOException e) { e.printStackTrace(); } String phpurl= prop.getProperty("phpaddress"); |
|