我在这里在 Wildfly-8.0.0.CR1 上使用 Richfaces-4.3.5,从中迁移<rich:fileUpload>
不适用于 JSF-2.2/Servlet-3.0。我用这个片段替换它:
<rich:popupPanel id="testPop" autosized="true">
<h:form id="uploadF" enctype="multipart/form-data">
<h:inputFile value="#{bean.file}">
<a4j:ajax listener="#{bean.storeFile()}" render="@form,:fileListTbl"
oncomplete="#{rich:component('testPop')}.hide();" />
</h:inputFile>
</h:form>
</rich:popupPanel>
这很好用,因为该storeFile
方法被调用并且我可以bean.file
正常访问。但是,我想rich:popupPanel
在上传完成后关闭,所以我需要对 ajax 请求的成功/完成事件做出反应。但这似乎不可能 - 弹出窗口保持可见并且响应显然不完整(为了更好的可读性而缩进):
<?xml version='1.0' encoding='UTF-8'?>
<partial-response id="j_id1">
<changes>
<update id="j_id1:javax.faces.ViewState:0">
<[CDATA[-1186354868983349335:-5499969782208038164]]>
</update>
<extension id="org.richfaces.extension"><render>@component</render></extension>
</changes>
</partial-response>
尽管 Richfaces 调试消息表明正在调用处理程序:
RichFaces: Received 'success' event from <input id=uploadF:j_idt1136 ...>
RichFaces: Received 'complete' event from <input id=uploadF:j_idt1136 ...>
所以,一个简单的问题:我怎样才能关闭弹出窗口并重新渲染组件?