PrimeFaces中的渲染属性

时间:2012-02-23 15:38:13

标签: java jsf-2 primefaces

我希望有一组仅在满足某个条件时才会呈现的组件。像这样:

<p:ajax event="select" update=":containerEditorForm:eventTabs:actionProperties"/>

...

<p:column>
    <p:outputPanel id="actionProperties">
        <p:outputPanel rendered="#{commandBean.eventList.activationActionTree.selectedNode ne null}">
            <p:message>message1</p:message>
            <p:message>message2</p:message>
        </p:outputPanel>
    </p:outputPanel>
</p:column>

上述解决方案工作正常,但是为了实现这一点,是否真的有必要使用两个outputPanel组件或其他一些容器组件? (外部面板具有id属性,内部面板具有rendered属性。)理想情况下,我会在同一元素中使用idrendered,但这样似乎不起作用。

1 个答案:

答案 0 :(得分:1)

您使用JSF标记来呈现组件,就像我提到的那样是使用id。

<h:panelGroup rendered="#{bean.id > 0}" id="hello">