Java Reference
In-Depth Information
scriptletClass="net.ensode.jasperbook.
ReportVariableModificationScriptlet">
<variable name="someVar" class="java.lang.String">
<initialValueExpression>
<![CDATA["This is the initial variable value."]]>
</initialValueExpression>
</variable>
<title>
<band height="30">
<textField>
<reportElement width="555" height="30" x="0" y="0"/>
<textFieldExpression>
<![CDATA[$V{someVar}]]>
</textFieldExpression>
</textField>
</band>
</title>
</jasperReport>
Compiling and filling this JRXML template results in the following report:
Notice how the report displays the variable value set in the scriptlet.
Before moving on, it is worth mentioning that we can add any additional methods
we need to our scriptlets. Reports can call these methods by using the built-in
parameter REPORT_SCRIPTLET . For example, if our scriptlet has a method called
foo() , a report could access it by using the syntax $P{REPORT_SCRIPTLET}.foo() .
 
Search WWH ::




Custom Search