Defines a composition that optionally uses a template, as outlined in the description of the ui tag library. Multiple compositions can use the same template, thus encapsulating and reusing layout. JSF disregards everything outside of the composition, which lets developers embed compositions in well-formed XHTML pages that can be viewed in an XHTML viewer, such as Dreamweaver or a browser, without including extraneous elements such as head
and body
.
<!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:ui="http://xmlns.jcp.org/jsf/facelets">
<body>
THIS LINE, AND EVERYTHING ABOVE IT IS DISREGARDED BY JSF
<ui:composition template="/layout.xhtml">
<ui:define name="title">#{msgs.contactsWindowTitle}</ui:define>
<ui:define name="heading">#{msgs.contactsHeading}</ui:define>
<ui:define name="content">
<ui:include src="contactsTable.xhtml" />
</ui:define>
</ui:composition>
THIS LINE, AND EVERYTHING BELOW IT IS DISREGARDED BY JSF
</body>
</html>