I've got a Collection of Java objects with getters that I want to use to populate a report in Jasper Server. I've searched and found http://enholm.net/index.php/blog/jasper-reports-custom-data-source-example/, but it uses an applicationContext.xml which is different from the one that I've got in JasperServer, and I don't know how to adjust it.
How would I use a Collection
What you need to do is follow the steps described -
1. First you need to create bean like:
3. Then you need to compile it and add it as an jar in the folder structure(C:\Program Files\jasperreports-server-x.x\apache-tomcat\lib.).
4. Then while defining the datasource you need to set the following based on the above snippet and set the values as--
Sorry for the trouble actually there is a step missed,
after the step 3,
You need to add the Jar file to the classpath also.
you could add in the classpath by, Tools(in the Menu bar) --> select the Options --> Select the tab CLASSPATH --> Click on Add Jar
One thing more I want to clearify is that you need to put both these bean as well as the static factory function in one single java class and access it in setting up the datasource. So suppose you have the package name as com.sample.jasper and your class containing both the bean as well as the factory function is JasperBeanData so the expression for the
Factory Class : generateCollection.
Hope that this helps establishing the connection.
Please do reply if more clearifications are required.