Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best approach to use JasperReports?

Here we are talking about three main products: JasperReports: which is just a library to generate reports and fill it iReport: which is GUI tool to develop templates used by the above library JasperServer: which is full application with web interface for managing reports with users permissions and other features,

documentation is really not that good, i want to use the best of the above products to integrate JasperReports with my application (Spring/Hibernate), so please advice what is the best approach to do this,

1- design reports using iReport using embedded sql generation, and make it as a separate project from mine, I tried to use Hibernate or Spring within iReport but also I faced a lot of problems and no clear documentation for this part

2- attach it with my project, to use same Hibernate configuration, already created entities

3- try to use JasperServer which seems to be complicated, and then expose reports as webservices

or any other better, guaranteed approach, i know it's dependant on the way my project is dealing, but i've shortage in time, so it depends on the approach having better documentations or tutorials.

like image 423
Amr Faisal Avatar asked Jul 28 '10 14:07

Amr Faisal


People also ask

Why do we use JasperReports?

JasperReports is an open-source reporting tool for Java that is used for reporting of applications. This reporting tool helps in writing rich content onto the screen, to the printer, or into a variety of files like HTML, PDF, XLS, RTF, CSV, XML, ODT and TXT.

What is the use of JasperReports in Java?

JasperReports is an open source Java reporting tool that can write to a variety of targets, such as: screen, a printer, into PDF, HTML, Microsoft Excel, RTF, ODT, comma-separated values (CSV) or XML files. It can be used in Java-enabled applications, including Java EE or web applications, to generate dynamic content.

Where do I put JasperReports properties?

jasper. properties is looked up by jasper reports in the classpath, so it can be directly in the WEB-INF/classes folder, or in the root folder of any of the jars in WEB-INF/lib.


2 Answers

You can write your own Jasper framework in a module or subproject. You can maintain report definitions separately from queries and feed them with data produced by your code.

This way all data and handling stays in your project where it's easier to track or edit (e.g. when you only need to change an aspect of the query, add a filter or rewrite it for better performance). Also, this way you can use report data for something else (e.g. add CSV or XML output).

like image 51
Konrad Garus Avatar answered Oct 16 '22 16:10

Konrad Garus


See http://en.wikipedia.org/wiki/JasperReports for the "What is" part of your question.

I faced the same problems when considering to use Jasper-reports in my application, I ended up given it up completely.

Anyway, take a look at this post for more information about different report frameworks for Java. Generating Reports - What works for you?

I wholeheartedly recommend that you take a look at BIRT http://www.eclipse.org/birt/phoenix/

I've used it with both Spring and Hibernate, and have no complain so far.

like image 32
Jose Diaz Avatar answered Oct 16 '22 16:10

Jose Diaz