导出excel用ajax不行,提交form表单可以

导出excel用ajax不行,提交form表单可以。

一直用ajax找原因,网页不出现下载提示框

写了

response.setContentType("application/binary;charset=ISO8859_1");
Date now = new Date();
SimpleDateFormat toDoFormat = new SimpleDateFormat("yyyyMMddhhmmssSSS");
String nowTime = toDoFormat.format(now).toString();
ServletOutputStream outputStream = response.getOutputStream();
String fileName = new String(("88"+nowTime).getBytes(), "ISO8859_1");
response.setHeader("Content-disposition", "attachment; filename=" + fileName + ".xlsx");

提示框就肯定会有了

后来试了下form,成功了

然后百度了下:

http://bbs.csdn.net/topics/391901142



posted @ 2016-12-20 16:58  爱吐泡泡的小小鱼  阅读(9670)  评论(0编辑  收藏  举报