I'm new to JasperReport. I'm now making use of JasperReport in a Servlet to generate a chart with data from an external DataSource(say from Oracle). I also use iReport to design my report.
I have found out two approaches to generate charts: 1. i. Query the database in the Servlet, generate the chart and render into an java.awt.Image object. ii. Define a parameter of type java.awt.Image. Create an Image object in the report template and set its image expression as the parameter defined previously. iii. Pass the image created in the Servlet as parameter to the report.
2. i. Define the database query in iReport. ii. Create a Chart object in the report template. Set the data series of the Chart object to be the Report Fields generated by the query. iii. Include the scriptlet class generated by iReport in the webapp.
is there a better way then including the scriptlet in the webapp? i cant rebuild my project every time, if a chart has changed. to put it in the classpath dont work, the classloader of the webapp dont find the scriptlet this way.