Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-2324

Jasper Reports Plugin is unable to set the imageServletUrl parameter for HTML report using struts.xml config

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.9, 2.0.10, 2.0.11
    • 2.1.1
    • Plugin - JasperReports
    • 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;
      }

      Attachments

        Activity

          People

            mrdon Donald J. Brown
            mugambs Mohammed Abdeali
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: