DataTable - Header and Footer Header and Footer section are defined using facets.
List of Cars
IdYearBrandColor
336014a21995HondaMaroon
00f6813a1971HondaYellow
dfe790962003JaguarGreen
6fe58e621990HondaBlack
0527a8ab1967RenaultBlue
c1f2edf52002RenaultMaroon
3f8937642007RenaultMaroon
b99cbe5e1976HondaMaroon
a60c52151998FiatWhite
b7971ba41995FordRed
<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.3-SNAPSHOT on Mojarra-2.3.2.