私はjsfページに2つのprimefacesパネルコンポーネントを持っています.primefaces commandButtonをクリックしてパネルにいくつかのデータを表示し、ページの読み込み時にpanel1を表示したい.commandbuttonをクリックすると、他のパネルを表示したくないので、バッキングBeanでブール変数を定義しましたパネルの可視プロパティで使用しますが、機能しません。
バッキング Bean:
@ManagedBean
@SessionScoped
public class Bean implements Serializable {
private boolean show;
@PostConstruct
public void init(){
this.show=true;
}
public void action_commandButton(){
this.show=false;
}
}
JSFページ
<p:commandButton style="text-align: center;font-size:12px;"
action="#{bean.action_commandButton()}" value=""/>
<!--panel 1 -->
<p:panel visible="#{bean.show}">
<p:dataGrid>
<!-- data from datbase-->
</p:dataGrid>
</p:panel>
<!-- panel 2-->
<p:panel visible="#{!bean.show}">
<p:dataGrid>
<!-- data from datbase-->
</p:dataGrid>
</p:panel>
この問題を解決するには?前もって感謝します。