无法更新输出面板

时间:2014-01-18 05:09:30

标签: jsf primefaces facelets

在辅助bean中调用方法的ajax之后,我无法更新两个输出面板。

代码如下所示给出示例代码

abc.xhtml

<p:outputPanel id="criteriaPanel" rendered="#{myBean.showPanel}">
   <h:form id="loginForm">
     <ui:include src="login.xhtml" />
     <p:commandButton action="#{myBean.login}" value="Login" update="criteriaPanel successPanel" />
   </h:form>
</p:outputPanel> 

<p:outputPanel id="successPanel" rendered="#{!myBean.showPanel}">
   <h:form id="successForm">
     <ui:include src="success.xhtml" />
   </h:form>
</p:outputPanel>

MyBean.java

public class MyBean {
  private boolean showPanel = true;

  public void login() {
    this.setShowPanel(false);
  }

  public void setShowPanel(boolean showPanel) {
    this.showPanel = showPanel;
  }

  public boolean isShowPanel() {
    return showPanel;
  }

}

0 个答案:

没有答案