Inability to Display Inline Report Images

  • This is a continuation of the previous posting . I believe the new topic is more relevant.

    First, I now realize what you meant when you said to use the IMAGES_DIR_NAME
    as an attribute. You meant use an f:attribute to pass it through the
    reportFrame component to the JR filler. I now understand that f:param's are
    passed exclusively as report parameters and f:attributes are passed
    exclusively as export parameters and this is how the plugin distinguishes one
    type of parameters from the other. Changing things to use f:attribute for
    IMAGES_DIR_NAME did cause it to be passed in as a JRHtmlExportParameter as
    seen via the debugger in the JSF Plugin HtmlExporter.createJRExporter method.
    I decided to see if preventing the null from being placed into the
    nullimg_0_0_0 and nullimg_0_0_4 filenames would fix the issue, by altering the
    JR source code for class JRHtmlExporter from:

    String imageName = getImageName(imageIndex);
    imagePath = imagesURI + imageName;


    String imageName = getImageName(imageIndex);
    if (imagesURI == null) {
        imagesURI = "";
    imagePath = imagesURI + imageName;

    Once more through the debugger indicated that this indeed did get rid of the
    null in front of the img filename, but this did not cause the 404 errors to
    disappear. I'm still getting 404's for paths like this: http://localhost:8080
    Notice that null is now gone.

    By the way, the JasperReports Ultimate guide indicates the meaning of the
    numeric indices for each img_ as:

    Regardless of the output destination set for the generated HTML, the exporter always
    gives each image a name with the form of img_x_y_z[_z_z], where
    - x is the index of a document within the list of documents to export in batch mode.
    - y is the page index.
    - z values are a series of one or more element indexes that locate the image on the
    page, looping through nested frames if needed.

    So now my question is: what exactly is supposed to serve such URL's (assuming
    that such URL's are connected to the image byte data that was loaded by the
    JRFillImage class)? It almost seems that the images servlet mentioned in the
    JR webapp demo is a necessity? Is JSF supposed to somehow serve what is at
    this URL (which includes the JSF plugin package as part of the URL)? If so,

  • [b]I have finally succeeded in displaying the two report-referenced images
    within the inline HTML report!!!

    It required changes to the JSF_JR 1.0 beta-4 plugin code to get it working
    properly. I plan to provide a complete writeup within the next couple of days
    under this topic.

  • Ney Palma
    Ney Palma

    Hi Gregg can you help me? can you tell me how did you resolve the image of report problem please.


    • It has been a long time since I looked at this, so don't expect any useful
      help beyond what is stated below, but I did get this working using different
      approaches as shown in the different zips.

      You can download what I created for Alonso using the information below.
      There are readme's in some of the archives. I have also placed a message
      that I sent to Alonso in this email chain:


      Connected to

      220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------

      220-You are user number 1 of 50 allowed.

      220-Local time is now 19:16. Server port: 21.

      220-This is a private system - No anonymous login

      220-IPv6 connections are also welcome on this server.

      220 You will be disconnected after 15 minutes of inactivity.

      User (

      331 User OK. Password required

      Password: @1pub

      230-OK. Current restricted directory is /

      230 147467 Kbytes used (7%) - authorized: 2048000 Kb

      ftp> ls

      200 PORT command successful

      150 Connecting to port 58757




      226-Options: -a

      226 7 matches total

      ftp: 136 bytes received in 0.00Seconds 136000.00Kbytes/sec.

      ftp> prompt

      Interactive mode Off .

      ftp> binary

      200 TYPE is now 8-bit binary

      ftp> mget *

      200 TYPE is now 8-bit binary

      200 PORT command successful

      150-Connecting to port 58796

      150 27727.5 kbytes to download


      From: Gregg Leichtman
      Sent: Monday, August 20, 2012 12:05 AM
      To: 'Alonso Dominguez'
      Subject: RE: Team Effort to Resolve Image Loading Issue

      I finally had a few minutes to try the image servlet approach that I
      mentioned earlier and have succeeded in getting it to work. Only a small
      change was needed to the net.sf.jasperreports.jsf.engine.export.
      ExporterBase.export method as shown below:

      import javax.servlet.http.HttpServletRequest;


          try {
                // GSL
                HttpServletRequest request = (HttpServletRequest)


      ATTRIBUTE, print);

                // end GSL
          } catch (final JRException e) {
              throw new ExporterException(e);


      You could conditionally place the print object in the session by only doing
      it, if IS_OUTPUT_IMAGES_TO_DIR is false, but I have not bothered. If you
      are worried about session bloat when IS_OUTPUT_IMAGES_TO_DIR is true, you
      could do this, but I didn't really see the need.

      I also added the following to my webapp web.xml:

         <!-- Jasper Reports -->



      and changed the demoReport.xhtml to be:

      <jr:reportFrame id="inlineReport" source="reportSource"

         height="600px" width="100%"
         format="html" frameborder="0" >
         <f:attribute name="IS_OUTPUT_IMAGES_TO_DIR" value="false"/>
         <f:attribute name="IMAGES_URI" value="/dart/view/image?image="/>


      These changes were done on top of the last dart war that I posted. I have
      posted a new working war:, at the same FTP site as
      before, that contains these changes.

      In case this is of interest, in order to get CDI working inside tomcat, I
      had to replace the existing J2EE bean-validator.jar from MyEclipse with the
      latest one from the J2EE-glassfish3 install, since there was a conflict with
      slf4j logging in weld and this jar (versions were out of sync). The new
      bean-validator.jar does not use slf4j for logging which avoids the conflict.

      I'm currently using:

      JRE name: Java HotSpot(TM) 64-Bit Server VM Vendor: Oracle Corporation
      Version: 23.1-b03
      glassfish.version = GlassFish Server Open Source Edition (build 5)
      java.class.version = 51.0
      java.runtime.version = 1.7.0_05-b06
      Mojarra 2.0.3 (FCS b03) (Need to update this.)

      -=> Gregg <=-

      From: Ney Palma []
      Sent: Saturday, April 13, 2013 3:11 PM
      To: [jasperreportjsf:discussion]
      Subject: [jasperreportjsf:discussion] Inability to Display Inline Report

      Hi Gregg can you help me? can you tell me how did you resolve the image of
      report problem please.


      Inability to Display Inline Report Images /?limit=25#a011

      Sent from because you indicated interest in

      To unsubscribe from further messages, please visit

      No virus found in this message.
      Checked by AVG -
      Version: 2013.0.3272 / Virus Database: 3162/6236 - Release Date: 04/10/13