I’m using the Grails Jasper report plugin in my application. Im trying to bind a collection of Expandos to my report template.
My Expando is built as follows
def calendarTask = new Expando()
calendarTask.title = task.name
calendarTask.date = new Date()
data.add(calendarTask)
I then bind the collection in my controller
chain(controller:'jasper', action:'index', model:[data:data], params:params)
In my report I have a field called “title” (type string) defined in my report template. When I try and run this report I get the exception below. Can you bind Groovy Expando collection to jasper reports?
java.lang.NoSuchMethodException:
Unknown property ‘title’ on class
‘class groovy.util.Expando’at
org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUtilsBean.java:1313)at
org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:762)at
org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:837)
I wrote a quick test script, and it gave the same error
So it looks like
common-beanutilsandExpandodon’t play well together…However, if you change from using
Expandoto just using a plainMap, the beanutils call works, so could you try changing your code to: