DataTable - Pagination

DataTable has built-in support for ajax pagination.

Ajax Pagination
ModelYearManufacturerColor
be55ea201994AudiBlack
d6a3602b1969AudiWhite
405759522003OpelOrange
698348111992VolkswagenBrown
38dbd2581961FordMaroon
d55e26d41977FordSilver
c2a38a931967VolkswagenYellow
dd0300051992MercedesYellow
73b98dc81992VolkswagenRed
24bac9641969ChryslerSilver

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>