I’m generating an HTML report for showing table data in a web application, using JasperReports and Spring MVC 3.
Does JasperReports provide some kind of pagination method? Or, is it possible to paginate data in the generated report using some Spring MVC utilities?
Yes, the JasperReports provides some pagination methods.
You can set this exporters parameters:
The
BETWEEN_PAGES_HTMLexporter parameter accepts a java.lang.String to replace the default page separator when exporting to HTML format.When set to Boolean.TRUE, the
IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWSexporterparameter ensures that all empty rows on the resulting HTML table are collapsed.
When
PROPERTY_ONE_PAGE_PER_SHEETis not set, all document pages will be printed out into a single sheet. Page breaks appear as supplementary empty rows between pages.You can read this guide for more information and explore this example for Struts.
You can use the
IS_IGNORE_PAGINATIONbuilt-in report parameter orisIgnorePaginationreport’s template property.You can set this parameters to avoid breaking documents into multiple pages.
You can use JasperReports API – JasperDesign.setIgnorePagination(boolean ignorePagination) method.
Additions:
The related post on SO: Is Jasper Reports the appropriate solution to display reports in a web application?
You can look at the sample report in
$JASPERREPORTS_DIR$\demo\samples\nopagebreakfolder (distributed with JasperReports pack).