Facelets Templating
Tag composition


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.

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2.         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3.  
  4. <html xmlns="http://www.w3.org/1999/xhtml"
  5.    xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
  6.  
  7.   <body>
  8.  
  9.     THIS LINE, AND EVERYTHING ABOVE IT IS DISREGARDED BY JSF
  10.     <ui:composition template="/layout.xhtml">
  11.  
  12.       <ui:define name="title">#{msgs.contactsWindowTitle}</ui:define>
  13.       <ui:define name="heading">#{msgs.contactsHeading}</ui:define>
  14.  
  15.       <ui:define name="content">
  16.         <ui:include src="contactsTable.xhtml" />
  17.       </ui:define>
  18.          
  19.     </ui:composition>
  20.     THIS LINE, AND EVERYTHING BELOW IT IS DISREGARDED BY JSF
  21.  
  22.   </body>
  23. </html>


Tag Information
Tag ClassNone
TagExtraInfo ClassNone
Body ContentJSP
Display NameNone

Attributes
NameRequiredRequest-timeTypeDescription
templatefalsefalsejavax.el.ValueExpression
(must evaluate to java.lang.String)

A URI that points to a template, also known as a layout, that inserts pieces of the page defined in the composition. If the URI cannot be resolved a TagAttributeException must be thrown, including accurate location information to help the page author resolve the problem. When the template is intended to come from a resource library contract, the value of this attribute must be an absolute path starting with "/".


Variables
No Variables Defined.