我们有两个CAF_H:CAF PORTLET中的PANELBLOCK ELEMENTS(id="panel1"
和id="panel2"
(,这些caf portlet应该根据支持bean的属性(rendered="#{ViewBean.property}"
和rendered="#{not ViewBean.property}"
(。P>
因此,此类面板的XHTML锁定如下:
<caf_h:panelBlock id="panel1" rendered="#{ViewBean.property}">
content
</caf_h:panelBlock>
声明了背景豆的属性如下:
private java.lang.Boolean property;
并在bean的初始化((方法中初始化:
public String initialize() {
this.property = true;
}
现在出现了棘手的部分:我们想通过单击命令链接来显示/隐藏这些面板:
<caf_h:commandLink action="#{ViewBean.click}" id="commandLink"></caf_h:commandLink>
此命令链接调用的bean方法依次更改属性的值:
public String click() {
this.property = false;
}
但是,块面板的可见性/渲染根本不影响。原因是什么?
事实证明,如果在Portlet生命周期中不再更改ViewBean.property
,则上述方式正常工作 - 就像我们在beforeRenderResponse()
方法中意外所做的那样。