Search code examples
javajsfjakarta-eejsf-2facelets

Difference between ui:composition and ui:decorate in Facelets


What are the differences between ui:composition and ui:decorate in Facelets ? Both seem to support ui:define as child tags . In what cases would you use each of these ?


Solution

  • Anything outside <ui:composition> tag is disregarded. This isn't true for <ui:decorate>, which is thus beneficial as "template-in-template".

    How that makes sense can maybe be better understood by looking at some real world examples in the below answers: