Hi.

  I made a little report with iReport, then I populated it from java code. I
tested it in the report viewer and everything goes right. Then, I added code
for export to HTML and inmediately send it to the browser, but my report
appears without images, wich are actually a chart. Any idea about the
problem? This is the code I use:


List alumnos = new ArrayList();
        
        for(int i=0;i<5;i++){
            AlumnoBean alumno = new AlumnoBean("Marcos"+i,new
Integer(23),new Long(i*2) );
            alumnos.add(alumno);
        }
        
        JRBeanCollectionDataSource ds =new
JRBeanCollectionDataSource(alumnos);
        
        //Create  compiled .jasper:                
        File reportFile = new
File(servlet.getServletContext().getRealPath("reportes/reporteAlumnos3.jrxml"));
        JasperDesign jasperDesign =
JasperManager.loadXmlDesign(reportFile.getPath());
        JasperReport jasperReport =
JasperManager.compileReport(jasperDesign);
        
        //create JasperPrint:
        JasperPrint
jasperPrint=JasperFillManager.fillReport(jasperReport,new HashMap(),ds);
        
        //exporting:
        try{
            PrintWriter printWriter=response.getWriter();
            JRHtmlExporter htmlExporter=new JRHtmlExporter();
            response.setContentType("text/html");
           
request.getSession().setAttribute(ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE,jasperPrint);
           
htmlExporter.setParameter(JRExporterParameter.JASPER_PRINT,jasperPrint);
           
htmlExporter.setParameter(JRExporterParameter.OUTPUT_WRITER,printWriter);
            Map imagesMap=new HashMap();
            request.getSession().setAttribute("IMAGES_MAP",imagesMap);
           
htmlExporter.setParameter(JRHtmlExporterParameter.IMAGES_MAP,imagesMap);
           
htmlExporter.setParameter(JRHtmlExporterParameter.IMAGES_URI,"image?image=");
            htmlExporter.exportReport();
        }catch(JRException e){
            e.printStackTrace();
        }
-- 
View this message in context: 
http://www.nabble.com/Problems-with-Charts-and-HTML-exporting-tf3985531.html#a11316206
Sent from the jasperreports-questions mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
jasperreports-questions mailing list
jasperreports-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jasperreports-questions

Reply via email to