O'Reilly logo

PrimeFaces Cookbook - Second Edition by Oleg Varaksin, Mert Çalışkan

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

Exporting data in various formats

The dataExporter component allows us to export the content of the table into various formats such as XLS, PDF, CSV, and XML. It also supports the exporting of the current data on a page. It also supports only selected data of the table by providing the ability to exclude particular columns and manipulate the exported data with pre- and post-processors.

How to do it…

A basic definition of dataExporter is given here:

<h:commandLink>
  <p:graphicImage value="/resources/images/export/pdf.png" />
  <p:dataExporter type="pdf" target="countriesTable"
    fileName="countries" />
</h:commandLink>

How it works…

The dataExporter component should be nested in a UICommand component, such as commandLink or commandButton. In the previous ...

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