1) In the main report, create DataSet
2) From Palette, add a List Element the report
3) A window is opened, select your DataSet
4) Double click on the List element. In the DataSet menu, fill in "Use JRDataSource Expression" with new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{customers})
5) Go back to your DataSet setup to add the Fields
6) Double Click on the list and drag and drop the fields in it
That's it !
Source code generated :
<componentElement>
<reportElement x="110" y="4" width="444" height="20" uuid="118abb83-369d-408b-a3bc-194b978d3fab"/>
<jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="customersDataSet" uuid="ce33a9a6-0aaf-4df0-abb7-fc52b0553191">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{customers})]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="20" width="444">
<textField>
<reportElement x="0" y="0" width="30" height="20" uuid="a65f7a8f-1530-4657-ac3d-a053ea18cb14"/>
<textFieldExpression><![CDATA[$F{civilite}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="30" y="0" width="120" height="20" uuid="5f85470a-8c28-4550-aac8-e414ff64fe90"/>
<textFieldExpression><![CDATA[$F{firstName}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="150" y="0" width="140" height="20" uuid="6a8c4e04-4278-4595-845f-67be590d9210"/>
<textFieldExpression><![CDATA[$F{lastName}]]></textFieldExpression>
</textField>
</jr:listContents>
</jr:list>
</componentElement>
<subDataset name="customersDataSet" whenResourceMissingType="Empty" uuid="10331e47-e08a-42d9-8733-bcf103ea7aed">
<queryString>
<![CDATA[]]>
</queryString>
<field name="civilite" class="java.lang.String"/>
<field name="firstName" class="java.lang.String"/>
<field name="lastName" class="java.lang.String"/>
</subDataset>