/** * 得到WebRoot文件夹下的根路径,及web项目的根路径 * @return */ public String getWebRootAbsolutePath() { String path = null; String folderPath = Path.class.getProtectionDomain().getCodeSource() .getLocation().getPath(); if (folderPath.indexOf("WEB-INF") > 0) { path = folderPath.substring(0, folderPath .indexOf("WEB-INF")); } return path; }
?