In the previous example, we saw that content from one page could be included in another page by using a combination of the
<ui:composition> tags. Let's discuss the
<ui:composition> tag in more detail.
When Facelets encounters a
<ui:composition> tag, it includes the surrounded content and "trims" the content outside this tag. The surrounded content is included as is, and unlike the
<ui:component> tag, is not wrapped in a UI component.
The following source code example demonstrates how to include a Facelets UI composition using the
<ui:include> tag. When the markup in the file named
composition.jsf is included, only the content inside the
<ui:composition> tag is rendered.
<!DOCTYPE html ...