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

发布于 2024-12-22 19:13:31 字数 386 浏览 3 评论 0原文

我有一个 Bean,它的一些属性是另一个 Bean 的引用,我想通过其相应的 get 方法在我的报告中显示该 bean 属性的某些属性。

例如:

class Person {
    private Address ad;

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

class Address {
    private String city;

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

我想传递一个人员集合作为报告的数据源,并且我想在报告中创建一个字段以显示集合中每个人员的地址所在的城市。

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.

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

够运 2024-12-29 19:13:31

您可以这样声明字段:

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

You can declare fields like this:

<field name="city" class="java.lang.String">
    <fieldDescription><![CDATA[person.address.city]]></fieldDescription>
</field>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文