Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is JasperReports the appropriate solution to display reports in a web application?

We want to generate Reports either embedded as html pages in a web app or downloadable as a pdf. Hence I came across JasperReports because it thought it would fullfill these requirements.

Currently we assume our report will have about 50-100 pages, consisting of nearly only histograms and some tables. The data is retrieved by some expensive queries from our DB.

After evaluating it the whole day i have several doubts regarding web app aspects.

1) Pagination: Of course I don't want to display all pages in a single web page. We need something like pagination. But JasperReports seems not to support this approach. The wepp demo, which comes with JasperReports, sketches the way to go: I have to create a JasperPrint, which is already the full report, allocating unrequired memory and which has performed the expensive queries. Then I could display a single page. But doing this again and again for each page does not appear as a proper solution to me.

2) As mentioned above, our report will mostly consist of diagrams. Images are generated during Exporting the JasperPrint to its output format. If I understand everything correct, the ImageServlet, which comes with JR, is capable but retrieve these images be

i) Reading the generated images from the file system
ii) the exporter has stored them in the session (therefore in memory).

Since I think we will have a lot of images ii) is not an option, if we want to keep the memory footprint of the webapp low. But on the other hand flooding the file system with files is also not the best idea i could imagine. Does it delete the files somewhen?

Did I got something wrong? Is my understanding Correct?

like image 418
Lars Avatar asked Mar 12 '09 19:03

Lars


People also ask

Why do we use Jasper reports?

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.

How do I run a Jasper server report?

To run a report on the server: 1. Once you have a connection to your server Connecting to JasperReports Server, navigate to your report's JRXML, and click Run Report Unit. If prompted to save the report unit, specify a location on your local computer and click OK.


1 Answers

Pagination

It's kind of your service design how your pageing ist implemented! PDF is an standalone output format for printing issues. It can't read more data from the server (without Web-Services and Reader Extensions). So you can define, that JasperReports should only a subset of your data for paging.

If you define datasets in JasperReports, you can reuse them without allocating unrequired memory.

Images

If you want images in your reports and keep your memory footprint low, write a balancing algorithm which generates the images when the server load is under a specified value (may be a dynamic value from the avg of the last day load).

Do you need real time creation of the images? If the images were created by a servlet, they'll be load to Memory. A Java App. can pass the images to the ReportGenerator.

images can be loaded from memory, from disk, or from a URL see; Jasper Reports Book P:170

The images should never be saved in the HTTP_SESSION! This is a total antipattern which causes memory bloating.

like image 76
Martin K. Avatar answered Oct 14 '22 16:10

Martin K.