tags: Java
, JasperReports
, J2EE
posted: Friday, April 8th, 2005
The most recent project I have been working on involved creating a large number of reports for the company’s extranet/intranet. In the past, I have usually done reports using some form of JSP and JDBC. But in this case, there is a large number of reports to be developed, and so I was tasked with researching some of the open source solutions for reporting, in hopes we could find a solution that would allow us to get the reports done faster, and be provided to the user with more functionality, and with less custom code.
In the end we compared Crystal reports with JasperReports, and JasperReports was picked. JasperReports is not only free, but also is proven in the Java world, and has a lot of users. It is customizable, since its Java and open source, and has support for using Collections or Lists of Business Objects, such as those populated via Hibernate.
Once JasperReports was chosen, I tested several GUI’s to help build the reports instead of editing them strictly in their native XML. JasperAssistant was found to be the best of all of them, and integrates seamlessly with Eclipse. If you are an Eclipse fan as I am, then you’ll love using JasperAssistant. It even allows you to preview the report against your database right in Eclipse.
Next, I looked into OpenReports. OpenReports is a front end for JasperReports. It was written in WebWork, and provides a lot of functionality that you would have to write yourself to get the reports running on the web. It comes with basic security (users, passwords, and reporting groups). You can assign which users can access which groups, and which reports are in which groups. You can also add parameters, and then assign them to a report. You create the JasperReport in JasperAssistant (or with any other tool, including a text editor if you want to do the XML by hand), and then compile it (which JasperAssistant does for you). Then when you add a new report to OpenReports, you select which JasperReport file to use, select your datasource, assign your parameters and the report is ready to be used on the web.
OpenReports allows the user to export the report as a PDF, HTML, CSV, XLS, or PNG. This is all done for you without any additional work. As for parameters, there is some good functionality built in. When you add a Date parameter to your report, it automatically brings up a calendar for the user to select the date with. Also, you can add a query parameter which runs an sql that you have specified, and populates a drop down select box with the results. Parameters can be marked as required or optional, can be several different data types, and can be told to come in in any order needed. There are other parameter options as well. It also allows the user to schedule a report and have it emailed to a user.
I have made some improvements to OpenReports, including the Collection/List functionality to use Business Objects which JasperReports supports, but OpenReports currently doesn’t. At some point I’ll pass that code on to the original developers.
In the end, with JasperReports and OpenReports, the only thing you have to worry about is creating the SQL to get the data. After that, it takes little work to provide a nice looking report in multiple formats on a web site.
Comments (273)
Leave a Comment
Pages: [28] 27 26 25 24 23 22 21 20 19 18 … 1 » Show All
Hi there,
look, i’ve a problem with the jasperserver instalation, I installed jasperserver locally without problems but then i did in a UNIX server and after installed when i’m trying to open the login.html, the server show me the next Exception:
16:27:04,641 ERROR [jsp],http-80-Processor2:711 - Servlet.service() for servlet jsp threw exception
java.lang.IllegalArgumentException: InputStream cannot be null
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:94)
at com.jaspersoft.jasperserver.war.common.SiteMenu.parse(SiteMenu.java:74)
at com.jaspersoft.jasperserver.war.common.SiteMenu.getMenu(SiteMenu.java:63)
at org.apache.jsp.WEB_002dINF.decorators.main_jsp._jspService(main_jsp.java:221)…
i unzipped the jasperserver folder into webapps on tomcat, but i don’t know if i need to do something else? can you help me?
tnks
Hi,i want to ask.Is it possible to create a custom query,for example,the client want to make a report based on dates that the items are sold,using between statements..Thanks a lot..
Pages: [28] 27 26 25 24 23 22 21 20 19 18 … 1 » Show All
RSS feed for comments on this post. TrackBack
I have a problem with my report generation in sql query that, when I use the to_char() function in group by clause and select clause with a parameter(to provide the date format dynamically) to convert date, it shows the error that not a group by expression.
can you please provide some info on this as how can I avoid this issue.
[code]:
select to_char(cr.CR_DATE,$P{ReportPeriod}) “Period”, cr.REQ_CLASS, count(*) “Request Count”
from paws2.C_REQUEST cr where cr.CR_USER like ‘%br%’ and cr.cr_date between TO_DATE(’09/09/2008′, ‘MM/DD/YYYY HH24:MI:SS’) AND TO_DATE(’10/09/2008′, ‘MM/DD/YYYY HH24:MI:SS’)+1 group by to_char(cr.CR_DATE,$P{ReportPeriod}), cr.REQ_CLASS
[/code]
The same query working fine in Toad, but not in OpenReports.