2012-02-23 116 views
1

我想要一组组件仅在满足特定条件时才呈现。事情是这样的:在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,但这似乎不起作用。

+3

看看这里进行了详细的解释http://stackoverflow.com/questions/4573190/jsf-primefaces-update-attribute-does-not-update-component – Daniel 2012-02-23 15:43:57

回答

1

您使用JSF标记渲染组件,就像我提到这是使用ID工作。

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

这不是什么OP是问。检查Daniel发布的重复问题链接。 – BalusC 2012-02-24 12:04:41