JasperReports是在Web应用程序中显示报告的适当解决方案吗? [英] Is JasperReports the appropriate solution to display reports in a web application?

查看:117
本文介绍了JasperReports是在Web应用程序中显示报告的适当解决方案吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们希望生成在Web应用中嵌入为html页面的报告,或者可以下载为 pdf 的报告。因此我遇到了 JasperReports ,因为它认为它会满足这些要求。

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.

目前我们假设我们的报告大约有50-100页,几乎只包含直方图和一些表格。我们的数据库中的一些昂贵的查询检索了这些数据。

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)分页:当然我不想在一个网页中显示所有页面。我们需要像分页这样的东西。但 JasperReports 似乎不支持这种方法。随着 JasperReports 附带的wepp演示,勾勒出前进的方向:我必须创建一个 JasperPrint ,这已经是完整的报告,分配不需要的内存并执行了昂贵的查询。然后我可以显示一个页面。但是对于每个页面反复执行此操作对我来说并不是一个合适的解决方案。

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)如上所述,我们的报告主要包含图表。在将 JasperPrint 导出到其输出格式期间会生成图像。如果我理解一切正确, JR 附带的 ImageServlet 有能力但是检索这些图像

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)从文件系统读取生成的图像

ii)导出器已将它们存储在会话中(因此在内存中)。

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

因为我认为我们会有很多图像ii)不是一个选项,如果我们想要保持webapp的内存占用率低。但另一方面,用文件充斥文件系统也不是我能想象的最好的主意。它会删除某些文件吗?

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?

推荐答案

分页

您的服务设计是如何实现您的分页的!
PDF是一种用于打印问题的独立输出格式。它无法从服务器读取更多数据(没有Web服务和Reader Extensions)。因此,您可以定义,JasperReports应该只是您的数据子集用于分页。

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.

如果在JasperReports中定义数据集,则可以重用它们而不分配不需要的内存。

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

图像

如果您想在报告中使用图像并保持较低的内存,请编写一个平衡算法,在服务器负载低于指定值时生成图像(可能是最后一天加载平均值的动态值。)

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).

您是否需要实时创建图像?如果图像是由servlet创建的,则它们将加载到Memory。一个Java应用程序。可以将图像传递给ReportGenerator。

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.


图像可以从内存,磁盘或URL中加载
见; Jasper Reports Book P:170

图像永远不应保存在HTTP_SESSION中!这是一个导致记忆膨胀的全反模式。

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

这篇关于JasperReports是在Web应用程序中显示报告的适当解决方案吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆