DataTable - Header and Footer

Header and Footer section are defined using facets.

List of Cars
IdYearBrandColor
c53e19a51995JaguarBlue
040f13061981AudiBlack
64b358861967MercedesWhite
1d5f91e01995VolkswagenRed
bc4066f51967FordOrange
d828f27e1991AudiWhite
92d7c61a1960RenaultRed
f10ef2a31995BMWRed
b502974c1982FordWhite
032cc0072006BMWRed
<p:dataTable var="car" value="#{dtBasicView.cars}">
    <f:facet name="header">
        List of Cars
    </f:facet>

    <p:column headerText="Id">
        <h:outputText value="#{car.id}" />
    </p:column>

    <p:column headerText="Year">
        <h:outputText value="#{car.year}" />
    </p:column>

    <p:column headerText="Brand">
        <h:outputText value="#{car.brand}" />
    </p:column>

    <p:column headerText="Color">
        <h:outputText value="#{car.color}" />
    </p:column>

    <f:facet name="footer">
        In total there are #{fn:length(dtBasicView.cars)} cars.
    </f:facet>
</p:dataTable>