我有包括两种形式的简单页面。 它们不能同时显示(一个切换的除外)。 下面是代码:
<h:body>
<ui:composition template="/elements/templateWithMenu.xhtml">
<ui:define name="content">
<p:dialog id="question1DialogId" widgetVar="question1Dialog" resizable="false" closable="false" visible="true">
<h:panelGroup id="questionStep1Group">
<h:form id="questionStep1Form" rendered="#{newPoll2.displayQuestionStep1}">
<h:commandLink value="next" action="#{newPoll2.questionStep1Completed()}" class="btn" >
<f:ajax execute="@form" render=":questionStep2Form :questionStep1Group :questionStep2Group"/>
</h:commandLink>
</h:form>
</h:panelGroup>
<h:panelGroup id="questionStep2Group">
<h:form id="questionStep2Form" rendered="#{newPoll2.displayQuestionStep2}">
<h:commandLink value="cancel" action="#{newPoll2.questionStep2Cancelled()}" class="btn" >
<f:ajax execute="@form" render=":questionStep1Form :questionStep1Group :questionStep2Group" />
</h:commandLink>
</h:form>
</h:panelGroup>
</p:dialog>
</ui:define>
</ui:composition>
</h:body>
questionStep1Completed()和questionStep2Cancelled()简单地切换在再现属性中使用的布尔值。
问题是与视图状态。 当第一次加载页面,点击“下一步”会工作,将与“取消”链接来代替。 但是,当我点击“取消”链接,它需要以被点击两次为它与“下一个”链接来代替。 我可以看到第一次点击,使没有视图状态的请求,而第二(成功)的人让与它的请求。
我看到了这个问题,而这个链接,你可以看到,我已经在渲染属性添加形式的ID,但它仍然无法正常工作。 有任何想法吗?
谢谢