response.setCharacterEncoding("utf-8");
response.setContentType("multipart/form-data");
String downloadFileName = "";
if (request.getHeader("User-Agent").toUpperCase().indexOf("MSIE") > 0) {
downloadFileName = URLEncoder.encode(fileRealName, "UTF-8");
} else {
downloadFileName = new String(fileRealName.getBytes("UTF-8"), "ISO8859-1");
}response.setHeader("Content-disposition", "attachment; filename=" + downloadFileName);
response.setContentType("multipart/form-data");
response.setContentType()不是确定输出流的格式么,还是输出什么文件都能用"multipart/form-data"
response.setContentType((mimetype != null) ? mimetype : "application/octet-stream");
response.setContentLength(workbook.getBytes().length);
response.setHeader("Content-Disposition", "attachment;filename=" + playdate + ".xls");
response.setHeader("Content-type", "application-download");
response.setHeader("Content-type", "application-download");加了这句,浏览器还是没有反应,response.setHeader()有什么顺序要求么?
"application-download"是说这个servlet能够提供所有格式的文件下载么?
现在我想实现jpg格式的图片下载和DOC格式的文件下载,response要怎么设置?