Struts 2文件上传在Chrome和Firefox中运行良好,但在IE中则无效

时间:2013-02-17 05:02:37

标签: struts2

我在Internet Explorer中为excel文件上传struts 2文件时遇到问题。它在Chrome和Firefox中运行良好,但我不确定我在IE中缺少什么。

这是我的struts配置:

<action name="uploadAction" method="submitServiceProfile" class="serviceProfileAction">
             <!-- <interceptor-ref name="exception"/>
             <interceptor-ref name="i18n"/> -->
             <interceptor-ref name="fileUpload">
                 <param name="allowedTypes">application/ms-excel,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</param>
                 <!-- <param name="maximumSize">20480</param> -->
             </interceptor-ref>
             <interceptor-ref name="params">
                 <param name="excludeParams">dojo\..*,^struts\..*</param>
             </interceptor-ref>
             <interceptor-ref name="validation">
                 <param name="excludeMethods">input,back,cancel,browse</param>
             </interceptor-ref>
             <interceptor-ref name="store">
                 <param name="operationMode">STORE</param>
            </interceptor-ref>
            <interceptor-ref name="someStack"/>

            <result name="success" type="redirectAction">managerPage</result>
             <result name="error" type="redirectAction">managerPage</result>
             <result name="input" type="tiles">homepage</result>

         </action>

1 个答案:

答案 0 :(得分:0)

正如user497087所建议的那样(谢谢!),我完全删除了allowedTypes,加上了interceptor-ref“fileupload”。现在,请求在任何给定的浏览器上都可以毫无问题地进入操作。