<textFieldExpresson> has a single sub-element, which is the report expression that
will be displayed by the text field, wrapped in an XML CDATA block. In this example,
each text field is displaying the value of a field. Therefore, the expression inside
<textFieldExpression> uses the <field> syntax explained previously.
Compiling a report containing a query is no different from compiling a report
without a query. It can be done either programmatically or through the custom
JasperReports JRC ANT task. We covered compiling reports in Chapter 3.
Generating the Report
As mentioned previously, in JasperReports terminology, the action of generating
a report from a binary report template is called illing the report. To fill a report
containing an embedded database query, we must pass a database connection object
to the report. The following example illustrates this process:
public class DbReportFill
public void generateReport()
connection = DriverManager.getConnection ("jdbc:mysql://
new HashMap(), connection);