后端java代码
把要下载的模板放在 resources资源文件目录下
//下载
@PostMapping("/downLoad")
public void downLoad(HttpServletResponse response){
//获取模板资源文件路径
String fileNamePath = this.getClass().getResource("/template/POSITION_NONSTANDARD.xlsx").getPath();
OutputStream output = null;
FileInputStream fis = null;
try {
//创建文件对象
File file = new File(fileNamePath);
fis = new FileInputStream(file);
String file_name = new String(fileNamePath.getBytes("UTF-8"),
"UTF-8");
//设置响应头
response.reset();
response.setCharacterEncoding("utf-8");
response.</