When creating a report, the first step is to create a JRXML template. As we mentioned in Chapter 1, An Overview of JasperReports, JasperReports JRXML templates are standard XML files but, by convention, they have an extension of .jrxml
and are referred to as JRXML files or JRXML templates. JRXML templates can be written by hand, alternatively, a visual report template generator can be used. The most popular JRXML report template generator is iReport. We will cover iReport in Chapter 10, Graphical Report Design with iReport.
All JRXML files contain a root <jasperReport>
element. The <jasperReport>
root element can contain many subelements, and all of these subelements are optional. Our goal for this chapter is to get a feel of how to design a report, so we will avert most of the <jasperReport>
subelements. We will use only one subelement, namely the <detail>
subelement.
Our first report will display a static string. Its JRXML is as follows...