1

I have a composite component which is composed of other composite components. Now I would like to render only some of the child components within the parent component. From the Java EE tutorial I take it that I should probably bind my child components to some property of the backing bean for my parent component so that I can access their render attribute.

However, the NetBeans IDE does not know about a binding attribute for my composite components. So how am I supposed to do this?

Use case: The parent component is some wizard which should display only one of the child components at a time. Think of it as a poor man's tabbed view. I know there are libraries which provide ready-made components for this, but I do not want to add another dependency.

Christian Schlichtherle
  • 3,125
  • 1
  • 23
  • 47

1 Answers1

4

Netbeans is lying. That attribute is definitely supported on <ui:component>. Just use it and ignore the warning/error in the IDE. Or better, just use the rendered attribute; the need to conditionally render components is not a valid reason to prefer binding over rendered.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Yes, NetBeans is lying, but also the Java EE tutorial 7 says that the `binding` attribute would be present for output tags, and my composite component is a `UINamingContainer`, not a `UIOutput`. – Christian Schlichtherle Jun 24 '13 at 11:27
  • No, it's present on [`UIComponent`](http://docs.oracle.com/javaee/6/api/javax/faces/component/UIComponent.html), which is also represented by `` (have you clicked the VDL link in my answer?). – BalusC Jun 24 '13 at 11:28
  • Thanks, I did, but I am using a custom component, that is the `interface` and `implementation` tags of the `http://java.sun.com/jsf/composite` namespace. Don't know how this relates to your tag. – Christian Schlichtherle Jun 24 '13 at 11:40
  • I know. Composite components are implicitly interpreted as ``. The "custom component" is by the way the wrong term for composite components. See further also http://stackoverflow.com/questions/6822000/when-to-use-uiinclude-tag-files-composite-components-and-or-custom-componen/6822269#6822269 and http://stackoverflow.com/tags/composite-component/info – BalusC Jun 24 '13 at 11:42