简体   繁体   English

如何使IReport访问JavaBean数据源上的get方法堆栈

[英]How to make IReport access a get method stack on a Javabean datasource

I have a Bean with some properties that is a reference for another Bean and I would like to show in my report some property of the property of the bean through its corresponding get method. 我有一个具有某些属性的Bean,该属性是另一个Bean的引用,我想在报告中通过其对应的get方法显示该Bean的某些属性。

For example: 例如:

class Person {
    private Address ad;

    public Address getAddress() {
        return this.ad;
    }
}

class Address {
    private String city;

    public String getCity() {
        return this.city
    }
}

I would like pass as a DataSource for the report a Collection of Person and I would like to create a field in the report to show the city of the address of each Person in the collection. 我想将“人员集合”作为报表的数据源传递,我想在报表中创建一个字段以显示集合中每个人员的地址所在的城市。

You can declare fields like this: 您可以这样声明字段:

<field name="city" class="java.lang.String">
    <fieldDescription><![CDATA[person.address.city]]></fieldDescription>
</field>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM