struts2做下载时老给图片文件和txt文件直接在浏览器打开了..超级郁闷啊.
public InputStream getInputStream(){ return ServletActionContext.getServletContext().getResourceAsStream("/upload/20032008126.jpg"); }
<action name="download" class="com.struts.action.DownloadAction"> <result name="success" type="stream"> <param name="contentType">image/jpeg</param> <param name="contentDisposition">filename="20032008126.jpg"</param> <param name="inputName">inputStream</param> </result> </action>