导出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




免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM