问答详情
源自:4-2 通过Struts2实现文件上传

上传文件后点提交,提示404错误

Type Status Report

Message /UploadAndDownload/upload.action

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

struts.xml 与 FileUploadAction配置和老师一模一样,之前有的也是这种错误,这究竟是怎么回事。

<struts>
    
    <constant name="struts.enable.DynamicMethodInvocation" value="false"></constant>
    <constant name="struts.devMode" value="true"></constant>
    
    <package name="default" namespace="/" extends="struts-default">
        <action name="upload" class="com.imooc.action.FileUploadAction">
            <result>/jsp/03.jsp</result>
            <result name="input">/jsp/error.jsp</result>
            <!-- 配置拦截器限制上传文件类型及大小 -->
            <interceptor-ref name="fileUpload">
                <param name="allowedTypes">image/bmp,image/x-png,image/gif,image/jpg</param>
                <param name="maximumSize">2M</param>
            </interceptor-ref>
            <interceptor-ref name="defaultStack"></interceptor-ref>
        </action>
    </package>
    
</struts>

struts.xml放在src下,完全无解


提问者:慕雪1014944 2017-09-15 07:16

个回答

  • YoungerC
    2017-09-17 23:14:19

    jsp文件找不到