Ext 表单提交
2019-10-16 16:57 yt1006574924 阅读(123) 评论(0) 编辑 收藏 举报1.String outFileName = "中文乱码+".xls";
resp.reset();
resp.setHeader("Content-Disposition","attachment;filename="+ new String(outFileName.getBytes(),"ISO-8859-1"));
//1.设置文件ContentType类型,这样设置,会自动判断下载文件类型
resp.setContentType("application/octet-stream;charset=UTF-8");
// 以流的形式下载文件
//读取文件
InputStream in = new FileInputStream(outFilePath);
ServletOutputStream outputStream = resp.getOutputStream();
//写文件
int b;
while((b=in.read())!= -1)
{
outputStream.write(b);
}
in.close();
outputStream.close();
out.close();
2.IE上提交参数含中文时需要转译,使用encodeURIComponent
![](https://img2020.cnblogs.com/blog/1072691/202004/1072691-20200421100012039-1124667848.png)