Portal Showcase

f:facet

This Facelet makes possible to add a named UIComponent nested to another. This way, developers can freely implement a more complex Facelet component than a simple attribute does.

常规的 Usage

f:facet is used in UIData (used by some components like h:dataTable) and by h:column. For custom developments, there are some methods available in UIComponentBase for obtaining those.
Customers
名字 Date of Birth 国家
Footer
John Adams 十一月 30, 1735 United States
Samuel Adams 十月 27, 1722 United States
Josiah Bartlett 十二月 21, 1729 United States
Carter Braxton 十月 16, 1736 United States
Charles Carroll 十月 19, 1737 United States
Benjamin Franklin 二月 17, 1706 United States
Elbridge Gerry 三月 03, 1701 United States
John Hancock 二月 23, 1737 United States
Thomas Jefferson 五月 13, 1743 United States
Francis Lewis 四月 21, 1713 United States

Source Code

<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets">

	<h:dataTable rows="10"
	value="#{dataTableBacking.customerDataModel}" var="customer">
		<f:facet name="header">
			<h:outputText value="#{i18n['customers']}" />
		</f:facet>
		<h:column>
			<f:facet name="header">
				<h:outputText value="#{i18n['first-name']}"/>
			</f:facet>						
			<h:outputText value="#{customer.firstName}" />
		</h:column>
		<h:column>
			<f:facet name="header">
				<h:outputText value="#{i18n['last-name']}"/>
			</f:facet>
			<h:outputText value="#{customer.lastName}" />
		</h:column>
		<h:column>
			<f:facet name="header">
				<h:outputText value="#{i18n['date-of-birth']}"/>
			</f:facet>
			<h:outputText value="#{customer.dateOfBirth}">
				<f:convertDateTime pattern="MMM dd, yyyy" />
			</h:outputText>
		</h:column>
		<h:column>
			<f:facet name="header">
				<h:outputText value="#{i18n['country']}"/>
			</f:facet>
			<h:outputText value="#{customer.country.countryName}"/>
		</h:column>
		<f:facet name="footer">
			<h:outputText value="#{i18n['footer']}" />
		</f:facet>
	</h:dataTable>
</ui:composition>
Liferay Faces Bridge Implementation 4.1.0 + Liferay Faces Portal 3.0.2-SNAPSHOT + Showcase Common 3.0.1 + Liferay Faces Util 3.1.0 + Mojarra 2.2.17