无组件的jsp文件下载
来源:互联网 发布:西门子数控铣床编程 编辑:程序博客网 时间:2024/06/05 17:35
<%@ page language="java" %>
<%@ page session="true" %>
<%@ page isThreadSafe="true" %>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="java.io.*,java.util.*" %>
<%
String fileReallyName = request.getParameter("file");
File zipFile = new File(fileReallyNam);
if(!zipFile.exist()){
out.print("文件不存在");
return;
}
response.setContentType("application/x-msdownload; charset=gb2312");
response.setHeader("Content-disposition", "attachment;filename=/"" + new String(fileReallyName.getBytes("GBK"),"ISO8859-1") + "/"");
FileInputStream fis = null;
ByteArrayOutputStream bos = null;
try
{
fis = new FileInputStream(zipFile);
bos = new ByteArrayOutputStream(8192);
int readline;
byte[] b = new byte[1024];
while((readline=fis.read(b))!=-1)
bos.write(b,0,readline);
bos.writeTo(response.getOutputStream());
out.clear();
out = pageContext.pushBody();
}catch(IOException e)
{
out.print("下载出错"+e.getMessage());
}finally{
try{
if(fis!=null) fis.close();
if(bos!=null) bos.close();
}catch(Exception e){
out.print("关闭文件流失败");
}
}
%>
- 无组件的jsp文件下载
- 无组件实现文件上传/下载
- 无组件实现文件上传/下载
- 无组件实现文件上传/下载
- 无组件实现文件上传/下载
- 无组件实现文件上传/下载
- 无组件实现文件上传/下载
- 无组件实现文件上传/下载
- 无组件实现文件上传/下载
- 无组件实现文件上传/下载
- 无组件实现文件上传/下载
- 无组件实现文件上传/下载
- 无组件实现文件上传/下载
- jsp的下载文件
- 解决asp无组件文件上传及下载大小限制
- jsp+servlet实现文件的上传和下载 运用了Apache Commons组件
- Asp无组件文件上传的实例
- jsp下载文件的method
- UN Calls For Action to Reduce Climate-Related Risks
- Linux网络篇
- UN Calls For Action to Reduce Climate-Related Risks
- UN Calls For Action to Reduce Climate-Related Risks
- UN Calls For Action to Reduce Climate-Related Risks
- 无组件的jsp文件下载
- 推荐两本书
- 英语学习
- 音视频同步
- Android学习笔记(八) TabWidget Service以及Tab子Activity之间的调用
- input-file的本地图片预览+等比例缩放-兼容IE8、火狐
- Google App Engine开发问题之javax.servlet.FilterChain is a restricted class
- [转] 从Junit迁移到TestNG
- 串口IC读写器程C++源码