/**
*手动敲的有问题 不要直接copy
*/
// 背景,linux中乱码,下载的xls文件是英文名,java 后台处理将英文名换成中文名
public void exorit(HttpSerlvetRequest request,HttpServletResponse response) throw Exception{
//处理文件格式
response.setContentType("application/x-msdownload");
File file=new File(request.getServletContent().getRealPath("")+"//resources//template/projectModel.xls");
//中文名称
String name="项目储备模板";
name=URLEncoder.encode(name,"UTF-8");
response.setHeader("Content-Disposition","attachment;fileName="+name+".xls");
OutputStream out;
File file=new File(files.getParent()+File.separator+"/项目模板"+".xls");
try{
FileInputStream inputStream=new FileinputStream(file);
out=response.getOutStream();
int b=0;
byte[]buffer=new byte[512];
b=intputstream.read(buffer);
while(b!=-1){
out.wirte(buffer,0,b);
b=inputStream.read(buffer);
}
inputStream.close();
out.close();
out.flush();
}catch(Exception e){
e.printerspace();
sysout();
}
}