Tuesday, May 04, 2010

JSF Composition Components vs. Composite components

 

Composition Components

Composite components

1

Composition components can use a template

e.g.

view.xhtml

<a:location …/>

location.xhtml

<ui:composition template=”section.xhtml”>

  <ui:define name=”contents”>

    <h:outputText …/>

  </ui:define>

</ui:composition>

Composite components cannot. The need to be decorated to confirm to a template.

e.g.

view.xhtml

<ui:decorate template=”section.xhtml”>

  <ui:define name=”contents”>

    <a:location…>

  </ui:define>

</ui:decorate>

Location.xhtml

<composite:interface>

  <composite:attribute …/>

</composite:interface>

<composite:implementation>

   …

</composite:implementation>

2

Composition components have no constructs to define action listeners and such

Composite components are more closer to a full blown custom component and can hence define action listeners

3

JSF 1 only

JSF 2 only

 

No comments: