I'm sending you a part of my code:

my web.xml contains:
 <servlet>
                <servlet-name>ImageServlet</servlet-name>
                <servlet-class>
                        net.sf.jasperreports.j2ee.servlets.ImageServlet
                </servlet-class>
        </servlet>
<servlet-mapping>
                <servlet-name>ImageServlet</servlet-name>
                <url-pattern>/reportImage</url-pattern>
        </servlet-mapping>
-----------------------------------
and my code is as following:
JasperReport jasperReport = getCompiledReport(reportPath);
                        JasperPrint jPrint =
JasperFillManager.fillReport(jasperReport, getGraphParameters(), ds);
                        request.getSession()

.setAttribute(ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE, jPrint);
                        ByteArrayOutputStream out = new
ByteArrayOutputStream();
                        String imgExtension =
String.valueOf(randomImageExtensionGenerator.nextInt());
                        exporter = new JRHtmlExporter();

exporter.setParameter(JRExporterParameter.JASPER_PRINT, jPrint);

exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, out);

exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI,
request.getContextPath()
                                        + "/reportImage?rnd=" + imgExtension
+ "&image=");
                        exporter.exportReport();

i add random parameters to the end of the image path in order to renew the
browser cache for every request.
I hope this helps.

Regards


On Wed, Feb 11, 2009 at 3:59 PM, Esaú Castillo Contreras <
esaucastil...@gmail.com> wrote:

> Hi!!
>
> I generated a file jrxml using the iReport 3.0.0 and when I try to print
> the report in a servlet the html doesn't show the images of a 3D Chart,
>
> This is the code in my servlet
>
>          JasperReport jasperReport =
> JasperCompileManager.compileReport(jrxmlPath);
>          JasperPrint jasperPrint =
> JasperFillManager.fillReport(jasperReport, parameters, getConnection());
>          JRHtmlExporter exporter = new JRHtmlExporter();
>
> request.getSession().setAttribute(ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE,
> jasperPrint);
>          exporter.setParameter(JRExporterParameter.JASPER_PRINT,
> jasperPrint);
>          exporter.setParameter(JRExporterParameter.OUTPUT_WRITER, out);
>
> exporter.setParameter(JRHtmlExporterParameter.IS_OUTPUT_IMAGES_TO_DIR,Boolean.FALSE);
>          exporter.exportReport();
>
>
> My project uses the library 3.1.3
>
> Thanks
>
> Esau
>
>
>
> ------------------------------------------------------------------------------
> Create and Deploy Rich Internet Apps outside the browser with
> Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code
> to
> build responsive, highly engaging applications that combine the power of
> local
> resources and data with the reach of the web. Download the Adobe AIR SDK
> and
> Ajax docs to start building applications today-
> http://p.sf.net/sfu/adobe-com
> _______________________________________________
> jasperreports-questions mailing list
> jasperreports-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jasperreports-questions
>
>
------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
jasperreports-questions mailing list
jasperreports-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jasperreports-questions

Reply via email to