Monday, 3 November 2008

The Definitive Guide to JasperReports - Part1

Today i started reading The Definitive Guide to JasperReports By Teodor Danciu , Lucian Chirita.

Nice book written by Teodor Danciu , Lucian Chirita.

I wanted to share few qoutations i found from this book found from the 1st 2 chapters.

1) JasperReports is a content-rendering library, not a standalone application. It cannot run on its own and must be embedded in another client- or server-side Java application. JasperReports is a pure Java library and can be used on any platform that supports Java. Being a library, JasperReports is completely agnostic about the environment in which it is used for generating reports.

All JasperReports functionality is concentrated in a single JAR file, jasperreports-x.x.x.jar, available for download at the following URL:

http://sourceforge.net/project/showfiles.php?group_id=36382&package_id=28579

2) JasperReports handles only reporting. It relies on third-party libraries and APIs to perform needed functionality like XML parsing, database connectivity, PDF or XLS output, and so on.

3) Building the Source Files and Running the Samples

The best way to start working with JasperReports is to download the full project package from the following SourceForge.net location:
http://sourceforge.net/project/showfiles.php?group_id=36382&package_id=28579

The jasperreports-x.x.x-project.zip file available at this location contains all the source files, required libraries, and freely available documentation, as well as a complete set of sample applications and reports.

Download the archive and extract its contents to the directory of your choice on your local machine. You’ll be able to see JasperReports in action without having to create a Java application to embed JasperReports in.

4) The entry point into the JasperReports object model is the net.sf.jasperreports.engine. design.JasperDesign class, whose instances represent the source report templates, also called the raw material.

5) Report Design Preview

The JasperReports library does not ship with an advanced GUI tool to help design reports. At this time, there are several third-party projects that provide such a tool.However, the library contains a very helpful visual component that lets you preview the report designs as you build them. The net.sf.jasperreports.view.JasperDesigner class is a simple Swing-based Java application that can load and display a report template either in its JRXML form or its compiled form. Even though it is not a complex GUI application and lacks advanced functionality like dragging and dropping visual report elements, it is a very helpful tool. All the supplied samples were initially created using this design viewer.All the supplied samples already have Ant tasks in their build.xml files that will launch this design viewer to display the report templates.

There are two Ant tasks for each sample report: viewDesign and viewDesignXML. The first one loads the compiled report template that is normally found in the *.jasper file. The second one loads the JRXML report template, which is more useful since you can edit the JRXML file and click the Reload button to immediately see the modification on the screen. To preview a sample report template if you have the Ant build tool installed on your system, simply go to the desired sample directory and enter something like the following from the command line:

>ant viewDesignXML
or
>ant viewDesign


About the Author

Teodor Danciu is the founder and architect of the JasperReports library, the most popular open source reporting tool, and is now working for JasperSoft. Before joining JasperSoft, Teodor worked for almost 8 years with several French IT companies as a software engineer and team leader on ERP and other medium-to-large database-related enterprise applications using mainly Java technologies and the J2EE platform. Teodor holds a B.S. in computer science from the Academy of Economic Studies in Bucharest.

Lucian Chirita joined Teodor Danciu at JasperSoft in the development of JasperReports library back in 2005, and he quickly became one of the main contributors to the project. Prior to joining JasperSoft, Lucian had 3 years of software engineering experience on several Java/J2EE products and applications. His contributions to JasperReports include support for crosstabs and integration with data query technologies such as Hibernate and OLAP. Lucian holds an M.S. in computer science from the University of Bucharest.

1 comment:

Anonymous said...

The first and second points require some clarification. While JasperReports is a java library, it should be clear that JasperSoft (the company behind JasperReports) also offers JasperServer which builds on JasperReports. JasperServer provides much of the infrastructure around JasperReports to make it a useful application without alot of development whether you choose to use the Community Edition or their Professional Edition.