f:facet |
|
The Facet tag registers a named facet on the component associated with the
enclosing tag. A facet represents a named section within a container component.
For example, you can create a header and a footer facet for a dataTable
component.
JSF Example
<!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:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<body>
<f:view>
<h:dataTable id="reportTable" value="#{reportController.dailyReport}"
var="item" border="1">
<h:column>
<f:facet name="header">
<h:outputText value="Daily Report" />
</f:facet>
<h:outputText value="#{item}" />
</h:column>
</h:dataTable>
</f:view>
</body>
</html>
This example was formatted by JSFToolbox for Dreamweaver.
Rendered Output
HTML Output
<table id="reportTable" border="1">
<thead>
<tr>
<th>Daily Report</th>
</tr>
</thead>
<tbody>
<tr>
<td>Item 1</td>
</tr>
<tr>
<td>Item 2</td>
</tr>
<tr>
<td>Item 3</td>
</tr>
</tbody>
</table>
|