SpringMVC中如何实现两种文件下载方式?
- 内容介绍
- 文章标签
- 相关推荐
本文共计374个文字,预计阅读时间需要2分钟。
使用Spring MVC实现文件下载有两种方式,都需要设置response的Content-Disposition为attachment; filename=test2.png。
第一种:直接向response的输出流中写入对应的文件流。
第二种:使用ResponseEntity字节传输。
本文共计374个文字,预计阅读时间需要2分钟。
使用Spring MVC实现文件下载有两种方式,都需要设置response的Content-Disposition为attachment; filename=test2.png。
第一种:直接向response的输出流中写入对应的文件流。
第二种:使用ResponseEntity字节传输。

