开发者

JasperReport 4.1.2 - Using complex Java Bean and subreports

开发者 https://www.devze.com 2023-04-09 22:34 出处:网络
I\'m facing a problem when trying to generate a report based on some java bean\'s. Suppose I have this 开发者_如何学编程configuration: a master bean, say

I'm facing a problem when trying to generate a report based on some java bean's.

Suppose I have this 开发者_如何学编程configuration: a master bean, say

Bean1

  • String name
  • String age
  • ArrayList bean2

Bean2

  • String text
  • ArrayList

Bean3 is the last child of the tree and it is composed by:

  • String text

(I have more levels but this is enough for you to understand) I'm using SubReport component to access data inside every ArrayList of a bean and it works well (using JRBeanCollectionDataSource()).

The problem is that, at Bean3, I have acess to all text fields of every Bean2. For example: I have an ArrayList<Bean2> of size 2: bean2_1 and bean2_2. bean2_1 has an ArrayList<Bean3> of size 2 and bean2_2 has an ArrayList of size 3.

When I print the content of Bean3 (field text) for bean2_1 and bean2_2, it shows all 5 text values for all my beans: bean2_1 and bean2_2. Anyone had already faced this problem? How can i bind the differente levels to show only the correct data??

Can anyone help ?

0

精彩评论

暂无评论...
验证码 换一张
取 消