我正在创建一个简单的页面,在单击一个按钮后,它将一个 panelGroup 替换为另一个。首先,代码:
<h:body>
<ui:composition template="/elements/templateWithMenu.xhtml">
<ui:define name="content">
<div class="rightContent">
<h:panelGroup id="lol" rendered="#{test.firstStep.booleanValue()}">
<h3>This should disappear</h3>
<h:form id="newPollForm1" rendered="#{test.firstStep.booleanValue()}">
<fieldset>
<h:commandLink value="Next" action="#{test.firstStepCompleted()}" >
<f:ajax execute="@all" render="lol" />
</h:commandLink>
</fieldset>
</h:form>
</h:panelGroup>
<h:panelGroup rendered="#{test.secondStep.booleanValue()}">
Works!
</h:panelGroup>
</div>
</ui:define>
</ui:composition>
</h:body>
支持 bean 只是将 firstStep 设置为 false,将 secondStep 设置为 true。
现在,当我尝试运行它时,我得到了<f:ajax> contains an unknown id 'lol' - cannot locate it in the context of the component j_idt39
. 谷歌搜索了一下,我发现对于表单范围之外的元素,我需要使用 SEPARATOR_CHAR (:)。那没有用。所以我尝试弄乱#{component}和#{cc}的不同组合,但没有任何效果。我什至找到了这个很棒的解释,但我又一次惨败。如果我使用@all,一切正常(一个面板被另一个面板替换),但我确实需要渲染一个特定的组件。
帮助?请?