//设置Content-Disposition
response.setHeader("Content-Disposition", "attachment;filename="+docName);
//读取文件
InputStream in = new FileInputStream(fullFileName);
OutputStream outs = response.getOutputStream();
//写文件
int b;
while((b=in.read())!= -1)
{
outs.write(b);
}
in.close();
outs.close();