ui:define

ui:define can create sections inside a template that is using any of ui:component, ui:composition, ui:decorate or ui:fragment.

General Usage

To define names for each section, it's mandatory to use name attribute. For inserting content into these sections, use ui:insert.


INSERTED TEXT

Source Code

  1. <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
  2.  
  3. <ui:decorate template="template.xhtml">
  4. <ui:define name="defineContent">
  5. <br/><br/>INSERTED TEXT
  6. </ui:define>
  7. </ui:decorate>
  8.  
  9. </ui:composition>
  1. <ui:composition xmlns="http://www.w3.org/1999/xhtml"
  2. xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
  3. xmlns:h="http://xmlns.jcp.org/jsf/html">
  4. <ui:insert name="defineContent">
  5. <h:outputText value="#{i18n['this-text-comes-from-a-template']}"/>
  6. </ui:insert>
  7. </ui:composition>
Liferay Faces Bridge Implementation 5.0.0 + Showcase Common 3.1.1 + Liferay Faces Util 3.4.1 + Mojarra 2.2.20