DataTable - Header and Footer

Header and Footer section are defined using facets.

List of Cars
IdYearBrandColor
b5d7bfd91995MercedesGreen
ebdb30df1999FiatYellow
b626405c1981VolkswagenWhite
bcc03ff22005BMWBlack
04a805d71988BMWBlack
22d1e0a71996RenaultBlue
50ccfd331977VolkswagenBlack
a9fa9ec52004MercedesOrange
528b05421989HondaRed
f7a0cf391973MercedesOrange
<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>