我有以下jsp文件:
byte[] file=null;
String ctype ="application/pdf";
RispostaPdf risposta = (RispostaPdf) session.getAttribute(Costanti.ATTRIBUTE_FILE_PDF);
String docName = risposta.nomeFile;
response.setContentType("" + ctype + "; name=\"" + docName + "\"");
//response.setCharacterEncoding("ISO-8859-1");
response.addHeader("Content-disposition", "inline; filename=\"" + docName + "\"");
file = risposta.modulo;
try {
OutputStream outStrm = response.getOutputStream();
outStrm.write(file);
outStrm.flush();
outStrm.close();
} catch (Exception e) {
out.println(e);
e.printStackTrace();
}
//response.flushBuffer();
session.removeAttribute(Costanti.ATTRIBUTE_FILE_PDF);
在新标签页中打开pdf文档。 当我从chrome保存pdf时,使用正确的名称(docName)保存:
filename=\"" + docName +
在IE中,最后一个版本(11/10/9)保存为downloadServletName.pdf:
任何人都知道如何在IE中将保存的文件名更改为“filename = \”“+ docName”?