response.setContentType("application/x-download");
response.setHeader("Content-Disposition", "attachment; filename=" + new String(filename.getBytes("utf-8"), "ISO8859-1" ) );
java.io.FileInputStream fis = new java.io.FileInputStream(targetFilePath);
byte[] b = new byte[2048];
int len;
while((len = fis.read(b)) > 0)
{
response.getOutputStream().write(b, 0, len);
}
fis.close();
response.getOutputStream().close();
out.clear();
out = pageContext.pushBody(); // the two lines can solve the problem of "getOutputStream() has already been called for this response"
解决getOutputStream() has already been called for this response
最新推荐文章于 2023-05-23 10:46:27 发布