0

CAF ポートレットに 2 つの caf_h:panelBlock 要素 (id="panel1"および) があり、これらはバッキング Bean (および)id="panel2"のプロパティに基づいてレンダリングされるはずです。rendered="#{ViewBean.property}"rendered="#{not ViewBean.property}"

したがって、このようなパネルの XHTML は次のようにロックされます。

<caf_h:panelBlock id="panel1" rendered="#{ViewBean.property}">
    content
</caf_h:panelBlock>

バッキング Bean のプロパティは次のように宣言されます。

private java.lang.Boolean property;

そして、Bean の Initialize() メソッドで初期化されます。

public String initialize() {
    this.property = true;
}

トリッキーな部分は次のとおりです。コマンドリンクをクリックして、これらのパネルを表示/非表示にします。

<caf_h:commandLink action="#{ViewBean.click}" id="commandLink"></caf_h:commandLink>

次に、このコマンド リンクによって呼び出される Bean メソッドは、プロパティの値を変更します。

public String click() {
    this.property = false;
}

ただし、ブロック パネルの可視性/レンダリングはまったく影響を受けません。その理由は何ですか?

4

1 に答える 1