struts2文件下载图片和txt文件会在浏览器打开解决

	    	<result name="downLoad" type="stream">
	            <param name="contentType">${contentType}</param>
	            <param name="contentLength">${fileSize}</param>
	            <param name="inputName">inputStream</param>
	            <param name="contentDisposition">attachment;filename=${downFileName}</param>
	            <param name="bufferSize">4096</param>
            </result> 

 

<param name="contentDisposition">attachment;filename=${downFileName}</param>
<!-- attachment; filename前加上attachment就行了  -->

 

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页