【发布时间】:2018-11-15 20:07:23
【问题描述】:
我正在尝试返回我使用 jsp 从服务器获取的 docx 文件
if(pathfile != null){
String mimetype=application.getMimeType(pathfile);
System.out.println("mimeType: "+ mimetype);
response.setContentType("application/ms-word");
response.setHeader("Content-disposition", "attachment; filename=Resultfile.docx");
File file = new File(pathfile);
FileInputStream fileIn = new FileInputStream(file);
//OutputStream output = response.getOutputStream();
int i;
while ((i=fileIn.read()) != -1) {
out.write(i);
}
fileIn.close();
}else{
%> <div>Khong co file</div> <%
}
但是当我尝试打开文件时,MSW 向我宣布了这一点 error 1 error 2
点击确定后我仍然可以阅读内容,但我不知道是什么问题,我该如何解决? 我用的是word 2016,服务器是websphere V9
【问题讨论】:
标签: java jsp servlets jakarta-ee websphere