When to use <ui:include>, tag files, composite components and/or custom components?

I started using JSF 2.0 with Facelets recently and got puzzled by new composite components knowing existing and other templating techniques offered by Facelets 1.x.

Use Facelet templates (as in  and/or ) if you want to split main page layout fragments into reuseable templates. E.g. header, menu, footer, etc.


Use Facelet tag files if you want to have a reuseable group of components in order to prevent/minimize code duplication. E.g. a group of label+input+message components. The major difference with composite components is that the output of a Facelet tag file does not represent a single UIComponent and may in some circumstances be the only solution when a composite component doesn't suffice.