DataTable - Header and Footer

Header and Footer section are defined using facets.

List of Cars
IdYearBrandColor
579cabee1984VolvoYellow
eac8ddc51983FiatYellow
3b9c0f5a2009FordSilver
bc32772c1988FiatRed
a30a37bd1971AudiGreen
54773af61990RenaultYellow
285e676f1993AudiOrange
205c577a1961FiatMaroon
9b7bec1a1980VolkswagenRed
950da6561991AudiBlack
<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>