/** * 获得应用中制定目录中文件的路径 * * @param servletContStriext * @param _dir:文件存放的目录 * @return */ public static String getServerFilePath(ServletContext servletContext, String _dir) { // String filePath = servletContStriext.getRealPath("/"); String path = null; if (ServerDetector.isTomcat()) { // tomcat server path = servletContext.getRealPath("/") + _dir + "/"; } else if (ServerDetector.isWebLogic()) { // weblogic server path = servletContext.getRealPath("/") + "\\" + _dir + "\\"; } return path; }