DataTable - Header and Footer

Header and Footer section are defined using facets.

List of Cars
IdYearBrandColor
2f5375cb1991MercedesRed
c312fc5b1990VolkswagenRed
fb9dd6502003AudiRed
241943861961VolvoRed
533bf7661984AudiWhite
f24ac1dd1977MercedesBlack
756e2e931976JaguarBlue
b1bc1d781993MercedesBlack
afb69dc71970JaguarBrown
91b2bff92007FordBrown
<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>