DataTable - Header and Footer Header and Footer section are defined using facets.
List of Cars
IdYearBrandColor
b54bf2891971VolkswagenBlue
937eb9291982HondaSilver
605a12651971RenaultGreen
6adeb17c2008VolvoOrange
47e2bc211986AudiWhite
9f64d8db1964HondaWhite
f7b895a41963MercedesGreen
53f937271970HondaBlack
3d37dba11976RenaultSilver
ddb0a2231985VolvoRed
<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>
                
PrimeTek, Copyright © 2017
All rights reserved.
Running PrimeFaces-6.2-SNAPSHOT on Mojarra-2.3.2.