String agent = request.getHeader("USER-AGENT");
String fileName = desc+".xls";
if (null != agent && -1 != agent.indexOf("MSIE")){
fileName = java.net.URLEncoder.encode(fileName, "UTF8");
}else if (null != agent && -1 != agent.indexOf("Mozilla")){
fileName = MimeUtility.encodeText(fileName, "UTF8", "B");
}
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
//response.setHeader("Cache-Control", "no-cache");
response.setHeader("Pragma", "no-cache");
response.setDateHeader("Expires", 0);
response.setHeader("Content-disposition" , "attachment; filename=" + fileName);
2011年11月3日 星期四
檔案下載時檔名在ie和firefox下面表現不一致問題
標籤:
JAVA
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言