Monday, February 14, 2011

I have ran into a problem when filling Jasper Reports that contain sub-reports. Jasper couldn't find by itself the sub-reports, although they were located into the same directory with the main report.
One way to solve this was to set the REPORT_FILE_RESOLVER parameter to the directory that contains the sub-reports, as describe here: http://forums.devshed.com/java-help-9/relative-path-for-subreport-in-jasperreport-309313.html
This created a problem because my code was packaged into a jar file that was part of an ear file and the approach described above wouldn't work, because I couldn't create a File object representing the sub-report directory to pass to the SimpleResolver class.
The best way I could find for doing this is to set the SUBREPORT_DIR parameter on the main report like this : "subreport_dir/".

No comments:

Post a Comment