String t=Thread.currentThread().getContextClassLoader().getResource("").getPath();
int num=t.indexOf(".metadata");
String t=Thread.currentThread().getContextClassLoader().getResource("").getPath();
String projectName = request.getServletContext().getContextPath();
int num=t.indexOf(projectName);
String path=t.substring(0,num)+projectName+FILE_SEPARATOR+"export";
int num=t.indexOf(".metadata");
String path=t.substring(1,num).replace('/', '\\')+"项目名\\WebContent\\文件";
//maven项目部署之后的文件路径读取
String FILE_SEPARATOR = System.getProperty("file.separator");String t=Thread.currentThread().getContextClassLoader().getResource("").getPath();
String projectName = request.getServletContext().getContextPath();
int num=t.indexOf(projectName);
String path=t.substring(0,num)+projectName+FILE_SEPARATOR+"export";
File f = new File(path.replace("/", FILE_SEPARATOR).replace("\\", FILE_SEPARATOR));
/maven项目本地环境的文件路径读取
String t=Thread.currentThread().getContextClassLoader().getResource("").getPath();
String projectName = request.getServletContext().getContextPath();
int num=t.indexOf(projectName);
String path=t.substring(1,num).replace('/', '\\')+projectName+"\\src\\main\\webapp\\export";
String path=t.substring(0,num)+projectName+FILE_SEPARATOR+"export";
File f = new File(path.replace("/", FILE_SEPARATOR).replace("\\", FILE_SEPARATOR));