java下载页面的显示类,可以直接调用
来源:互联网 发布:淘宝客服绩效在哪里看 编辑:程序博客网 时间:2024/09/21 09:02
public static void download(String path, HttpServletResponse response) {try {// path是指欲下载的文件的路径。File file = new File(path);// 取得文件名。String filename = file.getName();// 以流的形式下载文件。InputStream fis = new BufferedInputStream(new FileInputStream(path));byte[] buffer = new byte[fis.available()];fis.read(buffer);fis.close();// 清空responseresponse.reset();// 设置response的HeaderLong newDate=new Date().getTime();response.addHeader("Content-Disposition", "attachment;filename="+java.net.URLEncoder.encode("顺义区律师值班表"+newDate+".xls", "UTF-8"));response.addHeader("Content-Length", "" + file.length());OutputStream toClient = new BufferedOutputStream(response.getOutputStream());response.setContentType("application/vnd.ms-excel;charset=gb2312");toClient.write(buffer);toClient.flush();toClient.close();} catch (IOException ex) {ex.printStackTrace();}}
0 0
- java下载页面的显示类,可以直接调用
- 一个 可以直接调用windows phone DatePicker choose date页面的 自定义类
- java的静态方法可以直接用类名调用的理解
- java的静态方法可以直接用类名调用的理解
- java导出Excel文件,直接可以下载,然后更新状态,刷新页面
- Java 日期工具类 (可以直接调用)
- java中为什么类名可以直接调用静态方法?
- java类的构造方法可以直接调用该类中已有的方法。
- java 报表 可以直接打开,或下载
- 静态页面模板,比较不错的网站,效果比较多,html代码可以直接下载即可
- 页面调用方法弹出企业QQ联系客服的方法,可以直接复制过去使用
- android 文件上传类(可以直接被调用的)
- java直接输出Excel 页面实现下载
- C#可以直接调用的Win32API
- java中直接调用groovy的类.
- jsp中连接mysql的javabean 可直接调用显示页面为表格形式
- 不能下载的可以看源码的直接下载
- flex编译的代码可以拷贝到java后台直接访问flex页面
- 基因数据处理5之GRCH38数据源和查看信息
- hdu 2571 命运 简单DP
- 一种排序
- iOS8新特性之交互式远程通知
- java property.js与jquery兼容修改property.js源文件
- java下载页面的显示类,可以直接调用
- 【Android】安卓学习笔记之光照传感器的用法
- [Java] 算法学习之旅 [0] -- 求任意三位数各个数位上数字的和
- 数据结构习题集1
- SlikSvn的使用(命令版 )一
- HttpClient4.5教程-第三章-HTTP状态管理
- 梳理
- android onSaveInstanceState方法
- elk之logstash安装与配置