DataTable - Header and Footer

Header and Footer section are defined using facets.

List of Cars
IdYearBrandColor
7b3ab7371970FiatBlack
8b44958d1985HondaYellow
3d1a26691986AudiGreen
9cf5ea021979FordMaroon
534386b01993JaguarBlue
cf2272d12006VolvoYellow
3d82d34f1990FordBrown
10ef078b1996HondaOrange
d8e9a8051974FiatWhite
f54834262003VolkswagenSilver
<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>