gpt4 book ai didi

java - a4j : outputPanel ReRender does not work

转载 作者:行者123 更新时间:2023-11-29 07:19:16 26 4
gpt4 key购买 nike

我有一个基于某些 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com