JasperReports: How to call a java bean method in report template?

后端 未结 1 737
礼貌的吻别
礼貌的吻别 2020-12-03 08:59

I am passing a java bean collection into a jasper report. I have several fields for this java bean defined an they are display just fine in my report.

Im wondering i

相关标签:
1条回答
  • 2020-12-03 09:11

    Using the keyword _THIS in a field name or description will make it map to the bean class itself. Using the fieldDescription tag is better as it allows you to do this with multiple beans.

    For example:

    <field name="customBean" class="com.example.customBean">
        <fieldDescription>_THIS</fieldDescription>
    </field>
    

    Then you can call methods in an expression like this:

    <textFieldExpression>$F{customBean}.someMethod()</textFieldExpression>
    
    0 讨论(0)
提交回复
热议问题