如何填充Jasper report For a list of objects 其中每个对象里面都有一个对象列表?

How to populate Jasper report For a list of objects where each object has a list of objects inside?

对象是这样的

class jobVO{ 
    ...
    List<taskVO> tasks;
    ...
}
class TaskVO{
    String name;
    ...
}  

我需要将 List 传递给 jrxml 并打印。

我试过子报表。但在那里我找不到传递参数的方法。 还尝试使用集合数据源。我发现的问题是需要提及工厂方法。我的要求是动态创建此报告。

created 2 subreports

<detail>
    <band height="60" splitType="Stretch">
        <subreport>
            <reportElement x="-19" y="34" width="560" height="26" uuid="7006626b-cfcb-4dcc-a1c8-3ef0f95e0440"/>
            <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{items})]]></dataSourceExpression>
            <subreportExpression><![CDATA["D:\Root1\WEB1\src\sub1.jasper"]]></subreportExpression>
        </subreport>
    </band>
</detail>