Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.9, 2.0.10, 2.0.11
-
None
-
Windows XP SP 2, using struts 2.0.9 and Tomcat 5
-
Patch
Description
This is the config from struts.xml
<result name="success-html" type="jasper">
<param name="location">WEB-INF/classes/jasper/our_jasper_template.jasper</param>
<param name="dataSource">myList</param>
<param name="format">HTML</param>
<param name="imageServletUrl">/servlets/image?image=</param>
</result>
The problem is that the setter for this in the JasperReportResult class doesn't have a void return type, causing reflection problems and ultimately the parameter never gets set. This results in all the spacer and other images on the generated HTML report not being displayed
The workaround is to return the JasperReportsResult directly from the action class e.g.
public Result generateHTML() throws Exception {
buildDataStore();
JasperReportsResult result = new JasperReportsResult();
result.setLocation("WEB-INF/classes/jasper/our_jasper_template.jasper");
result = result.setDataSource("myList");
result = result.setFormat("HTML");
result = result.setImageServletUrl("/servlets/image?image=");
return result;
}