Exploiting the <ui:decorate> and <ui:fragment> tags

First, let's talk about the <ui:decorate> tag. As its name suggests, this tag is used for decorating pieces of a page. Unlike <ui:composition>, this tag doesn't ignore the content that is not enclosed in it, which may be an added advantage sometimes. Well, a simple example is shown in the following code (the template attribute is mandatory):

<?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> <h:head> <title></title> </h:head> <h:body> <h:outputText value="You ...

Get Mastering JavaServer Faces 2.2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.