ui:define |
|
The Define tag is a templating tag that defines named content to be inserted
into a template. The name attribute value must match that of a ui:insert tag in the target
template for the named content to be included.
template.jsf
<!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://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head />
<body>
<h:form>
<ui:composition template="template.xhtml">
<ui:define name="header">Hello World!</ui:define>
</ui:composition>
</h:form>
</body>
</html>
This example was formatted by JSFToolbox for Dreamweaver.
template.xhtml
<!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://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head />
<body>
<h2><ui:insert name="header" /></h2>
</body>
</html>
This example was formatted by JSFToolbox for Dreamweaver.
Rendered Output
HTML Output
<h2>Hello World!</h2>
|