Hi everyone,

This thread has already been posted, but no response was given...
So i give more infos about my config.
 
I desperatly try to display a report in HTML format from a servlet...

==> It works perfectly in PDF format (with the JasperExportManager.exportReportToPdf() method)


My webapp is deployed on JONAS server, in a war file, not in a explode form.
But Jonas creates automatically an exploded tree, from the war file.


##################
## in my servlet :
##################
PrintWriter out = res.getWriter();
res.setContentType("text/html");
JRHtmlExporter exporter = new JRHtmlExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_WRITER, out);
exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "images/");
exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, new Boolean(false));
try {
exporter.exportReport();
} catch (JRException jrex) {
...
}

##########################################################
## in my JRXML file, the image is renferenced like this :
##########################################################

<jasperReport
         name="CnxPerDayChartScriptlet"
         columnCount="1"
         printOrder="Vertical"
         orientation="Portrait"
         columnWidth="515"
         columnSpacing="0"
         leftMargin="40"
         rightMargin="40"
         topMargin="50"
         bottomMargin="50"
         scriptletClass="com.axiliance.realsentry.wssologs.charts.CnxPerDayChartScriptlet"
         whenNoDataType="NoPages"
         isTitleNewPage="false"
         isSummaryNewPage="false">

    [...]

    <!--
     * PARAMETERS :
     *  - a Dataset object
     *  - a ChartConfig object : report characteristics
    -->
    <parameter name="dataset" isForPrompting="true" class="org.jfree.data.category.CategoryDataset"/>
    <parameter name="chartDimension" isForPrompting="true" class="com.mycompany.charts.ChartDimension"/>

    [...]

            <image  scaleImage="Clip" vAlign="Top" hAlign="Center" isUsingCache="false" evaluationTime="Now" hyperlinkType="Reference"  hyperlinkTarget="Self" >
                <reportElement
                    mode="Opaque"
                    x="0"
                    y="60"
                    width="510"
                    height="660"
                    forecolor="#000000"
                    backcolor="#FFFFFF"
                    key="image"
                    stretchType="NoStretch"
                    positionType="FixRelativeToTop"
                    isPrintRepeatedValues="true"
                    isRemoveLineWhenBlank="false"
                    isPrintInFirstWholeBand="false"
                    isPrintWhenDetailOverflows="false"/>jasperreports-1.2.0
                <box border="Thin" borderColor="#000000" />
                <graphicElement stretchType="NoStretch" pen="None" fill="Solid" />
                <imageExpression class="java.awt.Image">
                    <![CDATA[
                    ((com.mycompany.charts.CnxPerDayChartScriptlet)$P{REPORT_SCRIPTLET}).generateChart($P{dataset},$P{chartDimension})
                    ]]>
                </imageExpression>
            </image>

    [...]


==> The generateChart() method of my CnxPerDayChartScriptlet (JRDefaultScriptlet) is responsible for generating the buffered image


##############################################
# in the html generated code, the IMG tag is :
##############################################

<img src="" ..../></td>




BUT BUT BUT...

... this image is not created, so when the browser GET the image, the response is 404...
I don't see any images in the exploded directory of my webapp.


 
I had a look to JRHtmlExporter class, trying to debug it.
I don't understand where or when the image is generated,
(i mean when the exportReport() method of JRHtmlExporter handles the ChartScriptlet work)

>>> A help would be deeply welcomed.
(JasperReports version : JasperReports 1.2.0)

Thanx in advance.

Reply via email to