Skip to end of metadata
Go to start of metadata

How Component Child Rendering Works

Any "container" or "layout" component is going to need to manage the way in which its children are rendered as well as decide whether they will be rendered. As a simple example, consider the standard <h:panelGrid> component. <h:panelGrid> needs to intersperse rendering the children with the <tr> and <td> elements that provide the grid markup html tags, so this component will return "true" for the "rendersChildren" property.

A component-and-renderer combination that returns true is asserting that the component will take full responsibility for what will be rendered by itself or any of its children. If your component is willing to take that responsibility, then it is legal to do so. Fortunately, it's easy to do something like what <h:panelGrid> does without knowing anything about the nature of the child components. All your component has to do is write out its decorations, then notify the child components to render themselves. The child components, in turn, will decide whether to manage their own children, in a recursive process going down the tree.

(Paraphrased from a message by Craig McClanahan)

Labels
  • No labels