DataTable - Header and Footer

Header and Footer section are defined using facets.

List of Cars
IdYearBrandColor
d1607b011966MercedesSilver
8da6f5481994BMWBrown
71fd11f61992RenaultGreen
491cfdca1971FiatOrange
17f592c81978RenaultBrown
7fd541231968HondaOrange
d919dded2003VolvoRed
5553ee9b1999JaguarWhite
e1c063ae1986RenaultBlack
d4ed452c1994VolkswagenRed
<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>