DataTable - Header and Footer Header and Footer section are defined using facets.
List of Cars
IdYearBrandColor
d11995671967MercedesOrange
951ab0122007JaguarRed
b665fc841997VolkswagenBlack
1ac0deca1979RenaultBlue
2f7852011961VolvoOrange
242ea9601999FordYellow
c6dc8b9a1961JaguarMaroon
53f891e32001BMWSilver
a7f330281991VolkswagenMaroon
b69a26271988FordGreen
<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.