Jasper Report First look

JasperReports provides the necessary features to generate dynamic reports, including data retrieval using JDBC (Java Database Connectivity), as well as support for parameters, expressions, variables, and groups. JasperReports also includes advanced features, such as custom data sources, scriptlets, and subreports.

Jasper Architecture
Overview of Jasper Reports

  • Jasperreport is open source Business intelligence reporting tool.
  • Jasper Reports is written in 100% Java. And can be embedded in any Java application.
  • JasperReports is an engine that takes an XML file and forms a report out of that file using the data source specified in the XML file.
  • Various output options PDF, HTML, XLS, CSV, XML, RTF, TXT files, or directly on the screen or printer.
  • Various data source options: JDBC, EJB, POJO, Hibernate, XML.
  • Integrated charting

Some of the Jasper report features:

  • It has flexible report layout.
  • It is capable of presenting data textually or graphically.
  • It allows developers to supply data in multiple ways.
  • It can accept data from multiple datasources.
  • It can generate watermarks.
  • It can generate subreports.
  • It is capable of exporting reports to a variety of formats.

JRXML in jasper
JasperReports reports are defined in an XML file format, called JRXML, which can be hand-coded, generated, or designed using a tool ( ireports , jasper studio ). The file format is defined by a Document Type Definition (DTD) or XML schema for newer versions, providing limited interoperability.
Structure of jrxml file

  • Report designs.
  • Parameters.
  • Data Source.
  • Fields.
  • Expressions.
  • VariablesReport
  • sections
  • Groups
  • Font and Unicode Support
  • Sub reports.

JasperReport – Parameters

Parameters are object references that are passed-in to the report filling operations.parameters are useful for passing to the report engine that it can not normally find in its data source Declaring a parameter in report design require specifying name and class :
There are also the built-in system parameters :

  • vREPORT_PARAMETERS_MAP
  • vREPORT_CONNECTION
  • vREPORT_DATA_SOURCE
  • vREPORT_LOCALE

JasperReport – Data Source
Jasper Reports support various types of data source using special interface called JRDataSource
There is default implementation of this interface (JRResultSetDataSource class ) that wraps a Result object . It allows the use of any RDMS database through JDBC. It also allows to use xml , xls , csv , java bean , NoSQL
JasperReport – Fields
Report fields present the only way to map data from data source into the report generating routines.
JasperReport – Expressions
Expression can be used for declaring report variables that performs various calculations, for data grouping on the report , to specify report text fields content , In an XML report design there are several elements in define expressions :
“Hi ” + $F{FirstName} + ” ” + $F{LastName} + ” welcome to asvignesh.in reports page” .
JasperReport – Variables
Report variables is special objects build on of top expression and be used simplify the report design by declaring an expression.
Variable can perform built-in types of calculations on their corresponding expression values like : count, sum, average, lowest , highest ….
Following built-in system variables :

  • PAGE_NUMBER.
  • COLUMN_NUMBER.
  • REPORT_COUNT.
  • PAGE_COUNT.
  • COLUMN_COUNT.
  • GROUPNAME_COUNT.

JasperReport – Groups Font and Unicode
Groups represent a flexible way to organize data on a report and introduce the corresponding and section on the report.
JasperReport – sub report
Subreports are an import feature for a report-generating tool. They allow the creation of more complex reports and simplify the design work.
The subreports are very useful when creating master-detail type of reports.
WYSIWYG Jasper Editor:

  • Jasper Assistant
  • iReport
  • Jasper Studio
  • Plugin for Eclipse and other IDE

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from

Subscribe now to keep reading and get access to the full archive.

Continue reading