DataTable - Pagination

DataTable has built-in support for ajax pagination.

Ajax Pagination
ModelYearManufacturerColor
a00330a01997AudiBlack
4a0aa3061981MercedesMaroon
1c6061c91997FerrariBlack
03ab83662007AudiMaroon
1ad429da1963OpelBlue
ff3fa68f1992BMWYellow
acc785c81961VolkswagenYellow
853e37ff1965AudiSilver
d0629b8a2000RenaultRed
d9cd1a922003RenaultBrown

Source

<h:form prependId="false">

    <p:dataTable id="dataTable" var="car" value="#{tableBean.cars}"
                 paginator="true" rows="10"
                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                 rowsPerPageTemplate="5,10,15">
        <f:facet name="header">
            Ajax Pagination
        </f:facet>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Model" />
            </f:facet>
            <h:outputText value="#{car.model}" />
        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Year" />
            </f:facet>
            <h:outputText value="#{car.year}" />
        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Manufacturer" />
            </f:facet>
            <h:outputText value="#{car.manufacturer}" />
        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Color" />
            </f:facet>
            <h:outputText value="#{car.color}" />
        </p:column>
    </p:dataTable>

</h:form>