DataTable - Header and Footer

Header and Footer section are defined using facets.

List of Cars
IdYearBrandColor
9f09d5622007BMWMaroon
83bd5f8e1994JaguarRed
6c3cdf651992RenaultBlue
bce7beb01988HondaBlue
d262a42e1979RenaultYellow
00bc03f52007VolkswagenGreen
a5b12d761999FiatGreen
837fd0081962JaguarGreen
1928f1fa1964JaguarGreen
dd80d18a2004FordBlue
<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>