我们在 CAF portlet 中有两个 caf_h:panelBlock 元素(id="panel1"
和id="panel2"
),它们应该基于支持 bean 的属性(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;
}
但是,块面板的可见性/渲染完全不受影响。可能是什么原因?