在使用jasperreport做报表,  
当嵌入子报表时,当子报表使用connection type使用datasource expression取数据
XML代码:
<subreport>
<reportElement positionType="Float" x="0" y="237" width="555" height="39" isRemoveLineWhenBlank="true"/>
<dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression>
<subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "customer_oppor.jasper"]]></subreportExpression>
</subreport>在父报表fillReport时把“REPORT_DATA_SOURCE”参数做为报表参数传入,
如:
paraMap.put("REPORT_DATA_SOURCE", new CustomerOpporDataSource(objectType,objectId,callerId,roleCode,sql1));
CustomerOpporDataSource实现了JRDatasource接口
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, paraMap, new ObjectDataSource(objectType,objectId,callerId,roleCode));  为什么总取不出数据出来显示????
当把connection type换成connection expression时只要把connection 做为参数传入就能取出数据。感谢!!!!