I have to generate a report, that displays info about one object ( so the input is only one bean ).
The first problem is – this bean should contain lists of sub-beans( for example, comments, with comment type and comment date ). So I can pass them to a sub-report.
The second problem is – there is an array of 4 sub-beans, that contains few fields. I can create a separate field for each sub-bean’s property ( firstSubBeanName, secondSubBeanName… ) , but it’s ugly :(. Ideally, there should be a way to access these beans in a such way :
$F{test}[0].name
Please help.
If your list have a name (ie is a property of the object), you have just to pass as Data Source Expression for the subreport this property
The subreport should be ready to receive such kind of data. If you are using struts, it is possible you should use this class:
as intermediary on your list field to be passed to the subreport.
The second question, the easy way is to use a list, so you can use this expression: