struts2.xml部分代码:
<result name="download_success" type="stream">
<!-- 下载流 getInputStream -->
<param name="inputName">${inputStream}</param>
<param name="contentType">${contentType}</param>
<!--<param name="contentType">application/octet-stream;charset=ISO8859-1</param>-->
<param name="contentDisposition">attachment;filename=${downloadFilename}</param>
</result>
action部分代码:
控制台报错:
真实路径/media/leslie/CAD7A9574394273E/upload/5e95c108-b1f3-4809-aa03-e069cbab0157.txt
2017-12-04 22:37:23,103 ERROR [org.apache.struts2.dispatcher.StreamResult] - Can not find a java.io.InputStream with the name [${inputStream}] in the invocation stack. Check the <param name="inputName"> tag specified for this action.
2017-12-04 22:37:42,896 ERROR [org.apache.struts2.dispatcher.Dispatcher] - Exception occurred during processing request: Can not find a java.io.InputStream with the name [${inputStream}] in the invocation stack. Check the <param name="inputName"> tag specified for this action.
java.lang.IllegalArgumentException: Can not find a java.io.InputStream with the name [${inputStream}] in the invocation stack. Check the <param name="inputName"> tag specified for this action.