Apache Struts 2 Documentation > Home > Guides > Plugin Developers Guide > JasperReports Plugin |
JasperReports is a powerful open source Java (LGPL) reporting tool that has the ability to deliver rich content onto the screen, to the printer or into PDF, HTML, XLS, CSV and XML files. |
The JasperReports plugin enables Actions to create high-quality reports as results.
To use this plugin, have your packages that contain the target actions extend the provided jasperreports-default package, which contains the jasper result type. Then, simply use the result type in the desired actions. The result takes the following parameters:
Generates a JasperReports report using the specified format or PDF if no format is specified.
Content-disposition = X; filename=X.[format]
).This result follows the same rules from StrutsResultSupport. Specifically, all parameters will be parsed if the "parse" parameter is not set to false.
<result name="success" type="jasper"> <param name="location">foo.jasper</param> <param name="dataSource">mySource</param> <param name="format">CSV</param> </result>
or for pdf:
<result name="success" type="jasper"> <param name="location">foo.jasper</param> <param name="dataSource">mySource</param> </result>
This plugin doesn't provide any global settings.
This plugin can be installed by copying the plugin jar into your application's /WEB-INF/lib directory. No other files need to be copied or created.