我不想用绝对路径,只想把这生成的excel通过相对路径保存在webroot下的excel文件夹中,能做的到么?
------解决方案--------------------------------------------------------
在Servlet 里用String webrootUrl = this.getServletContect().getRealPath("/");获得webroot路径
String excelFileUrl = webrootUrl + File.separator + excelFile + ...;
------解决方案--------------------------------------------------------
"java.io.FileNotFoundException: excel\a.xls "
liunx系统么?
String webrootUrl = this.getServletContect().getRealPath("/");
String excelFileUrl = webrootUrl + File.separator + excelFile + File.separator + "a.xls"
new File(excelFileUrl);
------解决方案--------------------------------------------------------
response.addHeader("content-type", "application/shlnd.ms-excel;charset=utf-8");
response.addHeader("content-disposition", "attachment; filename=wenjian.xls");