以流的形式将文件写入页面,直接下载
2016-08-30 10:41
120 查看
try {
OutputStream out = response.getOutputStream();
response.reset();
response.setHeader("content-disposition",
"attachment;filename="+java.net.URLEncoder.encode(reportName,"UTF-8")+".xls");
response.setContentType("APPLICATION/msexcel");
wb.write(out);
out.close();
} catch (FileNotFoundException e) {
throw new DAOException("");
} catch (IOException e) {
throw new DAOException("");
}
OutputStream out = response.getOutputStream();
response.reset();
response.setHeader("content-disposition",
"attachment;filename="+java.net.URLEncoder.encode(reportName,"UTF-8")+".xls");
response.setContentType("APPLICATION/msexcel");
wb.write(out);
out.close();
} catch (FileNotFoundException e) {
throw new DAOException("");
} catch (IOException e) {
throw new DAOException("");
}
相关文章推荐
- zabbix 邮件报错 Support for SMTP authentication was not compiled in
- 多线程异步处理示例
- 以流的形式将文件写入页面,直接下载
- 以流的形式将文件写入页面,直接下载
- 多线程异步处理示例
- 多线程异步处理示例
- 多线程异步处理示例
- 多线程异步处理示例
- zabbix 邮件报错 Support for SMTP authentication was not compiled in
- appium环境搭建
- gulp常用插件
- iOS btn实现collectionView方法
- jQuery通过parent()和parents()方法访问父级元素
- java的nio之:java的nio系列教程之buffer的概念
- 后台测试流程与经验分享
- 以流的形式将文件写入页面,直接下载
- 多线程异步处理示例
- 以流的形式将文件写入页面,直接下载
- 以流的形式将文件写入页面,直接下载
- 多线程异步处理示例