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?
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.
The images should never be saved in the HTTP_SESSION! This is a total antipattern which causes memory bloating.
No. You will have all sorts of problems.
I think that you just can generate your reports in XHTML/CSS, and if you need PDF rendering, just use Flying Saucer XHTML renderer.