问题
I am creating a report that has a subreport with ireport. The data source for both is java beans. The problem is that when I create the data source expression for the subreport, I will use:
new JRBeanCollectionDataSource($F{actions})
which is found on many docs.
When I compile I get:
JRBeanCollectionDataSource cannot be resolved to a type
I don't get it, it's a JasperReports class... how can it be missing. I even controlled the settings and the Jar with the class is in the classpath.
What could be the reason?
回答1:
Use data source as in jrxml.
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{actions})]]></dataSourceExpression>
回答2:
[SOLVED]here i have a similar situation, for the subreports at main report, that kind of conection works fine, but when i use the same "Data Source Expression" for the subreport of any subreport, i got that error:
JRBeanCollectionDataSource cannot be resolved to a type value = (net.sf.jasperreports.engine.JRDataSource)(new JRBeanCollectionDataSource(((java.util.List)field_graficoXY.getValue()))); //$JR_EXPR_ID=135$
You haven't got any solution yet?
main
|----subreport (ok)
| |---subreport (error)
|
|----subreport (ok)
来源:https://stackoverflow.com/questions/8244926/jasper-reposts-cant-compile-an-expression-that-contains-jrbeancollectiondatasou