O'Reilly logo

PrimeFaces Beginner's Guide by K. Siva Prasad Reddy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – using DataExporter to export data into XLS and PDF formats

Let us see how we can use various features of DataExporter, such as exporting a whole dataset, exporting the only current page, and excluding some columns:

  1. Create a DataTable and a DataExporter component to export all the data, only page data, and register pre- and post-processors for XLS and PDF exporters:
    <p:dataTable id="usersTbl" var="user" value="#{adminController.users}" rowKey="#{user.id}" paginator="true" rows="10"> <p:column headerText="Id"> <f:facet name="header"> <h:outputText value="Id" /> </f:facet> <h:outputText value="#{user.id}" /> </p:column> <p:column> <f:facet name="header"> <h:outputText value="Email" /> </f:facet> <h:outputText value="#{user.emailId}" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required