Struts2文件上传在Internet Explorer上不起作用 [英] Struts2 File Upload doesn't work on Internet-Explorer

查看:87
本文介绍了Struts2文件上传在Internet Explorer上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Internet Explorer中为Word文件(.docx,.doc)上传Struts 2文件时遇到问题.它在Chrome和Firefox中可以正常工作,但是我不确定IE缺少什么. 我正在使用IE9. 感谢您的建议.

I am having issue with Struts 2 file upload for Word file(.docx, .doc) in Internet Explorer. It works fine in Chrome and Firefox, but I am not sure what I am missing for IE. I am using IE9. I appreciate your advice.

<action name="saveOrUpdateUser" method="saveOrUpdate"
            class="com.adaptivsol.action.UsersAction">
    <interceptor-ref name="defaultStack">
        <param name="fileUpload.maximumSize">104857600</param>
        <param name="allowedTypes">
                text/plain,                 
                application/word,
                application/msword,
                application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,
                application/vnd.openxmlformats-officedocument.wordprocessingml.document
        </param>
        <param name="allowedExtensions">doc,docx,txt</param>
    </interceptor-ref>
    <result name="success">./pages/login/register.jsp</result>
    <result name="input">./pages/login/register.jsp</result>
    <result name="error">./pages/login/register.jsp</result>
</action>

推荐答案

您的参数有误,其中两个缺少fileUpload.前缀,它们必须为:

Your parameters are wrong, the fileUpload. prefix is missing in two of them, they need to be:

<param name="fileUpload.allowedTypes">
    text/plain,                 
    application/word,
    application/msword,
    application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,
    application/vnd.openxmlformats-officedocument.wordprocessingml.document
</param>
<param name="fileUpload.allowedExtensions">doc,docx,txt</param>

顺便说一句,在struts.xml中将devMode设置为true,并在此处发布文件上传停止工作的日志.我们需要查看错误,警告,消息以及一些了解什么地方出问题的东西.

By the way, set devMode to true in struts.xml, and post here the logs where the file upload stop working. We need to see an error, a warning, a message, something to understand what's wrong.

还要在您的JSP中添加 actionerrors,actionmessages

Also in your JSP add actionerrors, actionmessages and fielderrors printing capabilities, and report here the message you get.

这篇关于Struts2文件上传在Internet Explorer上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆