Skip to main content

Jasper Basics

This page summarizes the JasperReports concepts that matter most in ADITO projects. It is intentionally selective: the goal is not to replace the full vendor documentation, but to make the ADITO reporting pages easier to understand.

Design model

A Jasper report is a layout template. It does not fetch business data by itself in the recommended ADITO setup. Instead, ADITO prepares data in JDito and passes it into the report as fields, parameters, and optional subreport datasets.

In practice, this means:

  • JasperReports is responsible for layout and rendering.
  • JDito is responsible for data preparation.
  • ADITO views and actions are responsible for opening the report in the client.

Bands

The report canvas is divided into horizontal areas called bands. Each band has its own repetition behavior.

BandTypical use
TitlePrinted once at the beginning of the report
Page HeaderRepeated on each page
Column HeaderHeader labels for tabular detail content
Group HeaderPrinted when a group starts
DetailRepeated for each dataset row
Group FooterPrinted when a group ends
Column FooterFooter for a column area
Page FooterRepeated on each page, often for page numbers
Last Page FooterSpecial footer for the last page
SummaryPrinted once at the end
BackgroundUsed for watermarks or visual background elements

For most ADITO reports, the most important bands are Page Header, Column Header, Detail, and optionally Group Header / Group Footer.

Columns

Columns split the detail area into vertical lanes. They are useful for layouts such as label sheets or compact address outputs where multiple datasets should be printed next to each other.

Use columns only when the printed format really requires them. For most business documents, a single-column layout is easier to maintain.

Common elements

Everything visible in a report is built from elements. The most important ones are:

  • Static Text: fixed labels that never change
  • Text Field: dynamic values or expressions
  • Image: logos, signatures, or other images
  • Line, Rectangle, Ellipse: visual structure
  • Break: explicit page or column break
  • Subreport: embeds another report inside the current one

Static text vs. text fields

Use a Text Field whenever the text comes from data or needs to be translated. In multilingual projects, labels that must follow the ADITO client language should usually be implemented as expressions with $R{...} instead of hard-coded static text.

Fields, parameters, and variables

JasperReports stores values in three different ways:

TypePurpose
FieldRepeated data from the main dataset
ParameterSingle values passed into the report, such as dates, labels, flags, or subreport datasets
VariableCalculated values inside the report, for example totals or counters

In ADITO projects:

  • fields usually come from ReportData,
  • parameters are used for one-off values and special handover mechanisms such as adito.image.* or adito.datasource.*,
  • variables are useful for page numbers, counters, or report-local calculations.

Layout hygiene

A few basic layout rules save time later:

  • Delete unused bands instead of leaving large empty areas behind.
  • Keep band heights tight so records do not waste vertical space.
  • Reuse text formatting consistently instead of styling each field from scratch.
  • Prefer simple structures first, then add groups or subreports only where needed.

What belongs in Jasper and what belongs in JDito?

As a rule of thumb:

  • Put layout, formatting, and simple display expressions into JasperReports.
  • Put SQL, data aggregation, filtering logic, and report orchestration into JDito.

Avoid direct report-to-database connections where possible. In ADITO, the preferred approach is to provide the data explicitly from JDito so the report stays predictable and easier to test.

Continue reading