Jasper reposts can't compile an expression that contains JRBeanCollectionDataSource, why?

不问归期 提交于 2019-12-11 08:41:25

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!