@RequestMapping(value="/export",method=RequestMethod.GET) public ResponseEntity<byte[]> test(HttpServletRequest request) throws Exception { FileInputStream fileInputStream = new FileInputStream(String path);//path 文件路径 byte[] b = new byte[fileInputStream.available()]; fileInputStream.read(b); HttpHeaders headers = new HttpHeaders(); headers.add("Content-Disposition", "attachment;filename=a.xls"); //生成的文件名 return new ResponseEntity(b,headers,HttpStatus.OK); }
文件下载2
猜你喜欢
转载自blog.csdn.net/lq1083301982/article/details/86592537
今日推荐
周排行