DataTable - Header and Footer

Header and Footer section are defined using facets.

List of Cars
IdYearBrandColor
8395c37b1992VolkswagenOrange
dde069fc1976RenaultWhite
854eed971981RenaultWhite
e6037a0e1992VolvoSilver
0aba604e2006MercedesMaroon
9cae0cf82006FiatMaroon
468b00fb1986RenaultYellow
13b1f3cf2002RenaultRed
ced0d4351988BMWBlack
414a2d651980VolkswagenBlue
<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>