在文件下载中出现了问题:
下载.txt可以正常显示,如用.jpg下载后却无法显示;
为此我把原来的ContenType的octet_stream改成了image/jpeg;
效果还是一样不知什么原因.
<%@ page import="java.io.*"%>
<%
String root=application.getRealPath("/"

;
String name=request.getParameter("name"

;
String path=request.getParameter("path"

;
response.setContentType("image/jpeg"

;
response.setHeader("Content-Disposition",
"attachment; filename=\"" +name+ "\""

;
FileInputStream fileInputStream =
new FileInputStream(root + path);
int i;
while ((i=fileInputStream.read()) != -1) {
out.write(i);
}
fileInputStream.close();
out.close();
%>