【发布时间】:2014-12-03 00:48:28
【问题描述】:
我们正在从 jsf 1.2 升级到 jsf 2。
我们使用的是 apache myfaces 2.1 和 rich faces 4.3.5
对于rich:fileUplaod,我们面临以下问题。 下面是代码:
<h:form id="loadUsersForm">
<h:panelGrid columns="1">
<rich:fileUpload id="upload"
acceptedTypes="csv"
immediateUpload="true"
maxFilesQuantity="1"
listHeight="0px"
fileUploadListener="#{bean.uploadFile}"
addLabel="Ad File"
uploadLabel="Upload">
<a4j:ajax event="uploadcomplete"
execute="@this"
render="fText,clearButton" />
<f:facet name="progress">
<rich:progressBar style="display:none;"/>
</f:facet>
</rich:fileUpload>
<h:commandButton id="clearButton"
action="#{bean.clear}"
onclick="#{rich:component('upload')}.clear();"
value="Clear" />
<h:panelGrid/>
</h:form>
如上代码所示,我们正在使用另一个按钮来清除上传的文件。 以下问题仅在 IE8 上观察到(打开其兼容性视图模式):
1)当单击清除按钮时,对于onlick 脚本,#{rich:component('upload')}.clear(); IE 控制台报错为:Object doesn't support this property or method 并且未调用操作方法。当再次点击同一个按钮时,动作方法被成功调用。
2)当这个脚本被删除时,这个错误不会被观察到。但是观察到 action 方法的行为相同。只有单击两次清除按钮时才会调用 action 方法。
有人遇到过这样的问题吗? 谁能帮忙解决这个问题?
【问题讨论】:
标签: file-upload jsf-2 richfaces