问答详情
源自:4-5 通过Struts2实现文件下载

No result defined for action action.FileDownLoadAction and result downSuccess

        <action name="FileDownLoad_execute" class="action.FileDownLoadAction">

<param name="inputPath">/source/${downloadName}</param>  

<result name="downSuccess" type="stream">

<param name="contentType">application/octet-stream</param>

<param name="inputName">inputStream</param>

<param name="contentDisposition">attachment;filename="${downloadName}"</param>

<param name="bufferSize">8192</param>

</result>

        </action>

明明配置了啊  struts 用的2.3.3

提问者:ParaPeng 2017-02-04 13:49

个回答

  • ParaPeng
    2017-02-04 15:42:01

    然后还有一个问题是  如果namespace不为根目录的话 比如="/model/other"  一定要在

    <a  href="<%=path%>/model/other/FileDownLoad"/>中加入全路径 

    否则一直报

    No result defined for action action.FileDownLoadAction and result downSuccess


  • ParaPeng
    2017-02-04 14:11:50

    找到了问题  控制台输出了

    Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986

    tomcat8.5的问题 添加了一些验证

    原因是在url中传递中文导致的