Friday, January 27, 2006

Images in JasperReports

If you are going to use images in JasperReports, use a relative path. For example, in iReports, you add an image, in its properties, in the image tab, make sure the path is like:

images/mikesNaughtyImage.gif

Then, to actually have your report access it, you need to place the image inside the classpath of the webapp the report is being run in. For example, this is MyReports, and WEB-INF/classes is in the classpath. So, the path for the image should be:

WEB-INF/classes/images/mikesNaughtyImage.gif

When the app is deployed, this will become:

appserver_webapp_path/MyReports/WEB-INF/classes/images/mikesNaughtyImage.gif

I remember having issues with this months ago, good to come up with a simple way to do it! (if not pretty).

No comments:

Labels

Blog Archive

Contributors