java - a4j : outputPanel ReRender does not work

标签 java jboss richfaces seam

我有一个基于某些 boolean 条件呈现的 a4j:outputPanel:

<a4j:outputPanel id="someDisplayRegion" rendered="#{doc.ready &amp;&amp someClass.someBooleanMethod}"> 
    // bunch of stuff //
</a4j:outputPanel>

然后在同一个 .xhtml 页面上,我有一个下拉菜单,选择其中一个选项应该会重新渲染上述区域:

<rich:dropDownMenu>                                         
    <f:facet name="label">                                            
        <a4j:commandLink styleClass="btn-pulldown">                                             
            <span><h:outputText value="Export"></h:outputText></span>                                                       
            <span class="opener"></span>                                              
        </a4j:commandLink>                                        
    </f:facet>                                              

    <rich:menuItem  submitMode="none">                                                 
        <s:link                                                 
            rendered="#{someOtherBooleanMethod}"                                    
            value="#exportDoc"                                              
            action="#{runSomething.exportDoc()}"                                                
            reRender="someDisplayRegion"                                                
            target="downloadfile"                                                
       ><s:conversationId /></s:link>                                          
    </rich:menuItem>                                                                                 
</rich:dropDownMenu>

但是,当我从下拉菜单中单击菜单项时,它不会进入 someClass.someBooleanMethod,因此不会重新呈现 someDisplayRegion。 我做错了什么吗?

最佳答案

考虑 RichFaces 文档的这一点:

As with most Ajax frameworks, you should not attempt to append or delete elements on a page using RichFaces Ajax, but should instead replace them. As such, elements that are rendered conditionally should not be targeted in the render attributes for Ajax controls. For successful updates, an element with the same identifier as in the response must exist on the page. If it is necessary to append code to a page, include a placeholder for it (an empty element).

因此,在您的 outputPanel 周围添加一个包装器,并在 reRender 属性中定位该包装器。

<a4j:outputPanel id="wrapper">
    <a4j:outputPanel id="someDisplayRegion" rendered="#{doc.ready && someClass.someBooleanMethod}"> 
        // bunch of stuff //
    </a4j:outputPanel>
</a4j:outputPanel>


<s:link reRender="wrapper" [...] />

关于java - a4j : outputPanel ReRender does not work,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6697602/

相关文章:

java - Thingsboard Windows 安装错误

java - 我需要帮助 : Send a list of bytes with UDP to a Server, o 它适用于有符号/无符号字节

java - 如何通过套接字发送 ArrayList? (TCP)

java - TypeError : jQuery. 大气未定义 Packed.js:2261

ajax - a4j :push not using websockets and falling back to long-polling

java - 为什么 JAX-WS 需要包装类?

java - Eclipse 调试器看不到代码更改

jboss - Jasig CAS - 服务票据验证成功后的 404 代码

java - Red Hat 的 JBoss EAP 是您从 JBOSS.org 获得的 JBoss AS 代码的分支吗?

jsf - Richfaces 和 Primefaces 彼此兼容吗?