【发布时间】:2012-06-03 22:53:07
【问题描述】:
我正在创建一个简单的页面,该页面将在单击按钮后将一个 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}的不同组合,但没有任何效果。我什至找到了this 很棒的解释,但我又一次惨败。如果我使用@all,一切正常(一个面板被另一个面板替换),但我确实需要渲染一个特定的组件。
帮助?请问?
【问题讨论】:
-
您是如何使用“SEPARATOR_CHAR (:)”的?难道你不能只使用 CSS\js 来实现吗?
-
':lol' 和其他一些 ':something:somethingElse:lol'(我尽可能地剥离了附加的 xhtml)。
标签: jsf jakarta-ee jsf-2 el