public void afterDetailEval() throws JRScriptletException
detailEvalEndTime = System.currentTimeMillis();
System.out.println("Detail evaluation took "
+ (detailEvalEndTime - detailEvalStartTime) + " milliseconds.");
Each of the methods in the scriptlet would be run at the appropriate time, giving
us an idea of the area(s) that is/are suffering from performance problems. As we
mentioned previously, all that is needed to use a scriptlet in a report is to provide its
fully qualified name to the scriptlet attribute of the root <jasperreport> element
in the JRXML template. The following example illustrates this concept:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN"
<reportElement x="0" y="0" width="200" height="30"/>
This JRXML template is a slightly modified version of the template we saw in the
previous section. The only difference is that we assigned a value to the scriptlet attribute
of <jasperReport> . When filling the Jasper template generated by the preceding
JRXML template, we should see some console output similar to the following:
Column 1 initialization took 0 milliseconds.
Page 1 initialization took 0 milliseconds.
Report initialization took 0 milliseconds.
Detail evaluation took 31 milliseconds.