title: Jasper Reports empty PDF report problem, using Spring ModelAndView
body: <p>I am trying to generate PDF report with Jasper Reports using Spring. But report is always empty. I searched a lot and could not find problem. I tried to write byte[] pdfReport to OutputStream but result is same, report is always empty. </p>
  
  <p>I have 2 parameters one o them is testName and one of them is chart. Both can not display at pdf report.</p>
  
  <p>Thanks a lot for your help,</p>
  
  <p>Here is the code that generates report.</p>
  
  <pre><code>//My class extends MultiActionController
  
  DefaultPieDataset dataset = new DefaultPieDataset();
  
  dataset.setValue(String.format("%s, %s", "pie1", "pie1"),20);
  dataset.setValue(String.format("%s, %s", "pie2", "pie2"),80);
  
  JFreeChart chart = ChartFactory.createPieChart("testPie", dataset, true, true, false);
  
  Map model = new HashMap(); 
  model.put("chart", chart.createBufferedImage(200, 200)); 
  model.put("testName", "test report");
  model.put("format", "pdf");
  
  AbstractJasperReportsView  view = new JasperReportsMultiFormatView();
  view.setUrl("/WEB-INF/classes/reports/"+"test1"+".jasper");
  view.setApplicationContext(getApplicationContext());
  view.setContentType("application/pdf");
  
  Properties header = new Properties();
  view.setHeaders(header);
  
  ModelAndView mv = new ModelAndView(view, model);
  
  JasperReport report =  (JasperReport) JRLoader.loadObject(getServletContext().getResourceAsStream("/WEB-INF/classes/reports/"+"test1"+".jasper"));
  
  JasperPrint prt = JasperFillManager.fillReport(report, model);
  byte[] pdfReport = JasperExportManager.exportReportToPdf(prt);
  
  return mv;
  </code></pre>
  
  <p>And here is jrxml file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="test1" language="groovy" pageWidth="700" pageHeight="842" columnWidth="660" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20"&gt;
      &lt;property name="ireport.zoom" value="1.0"/&gt;
      &lt;property name="ireport.x" value="0"/&gt;
      &lt;property name="ireport.y" value="2"/&gt;
      &lt;parameter name="testName" class="java.lang.String"/&gt;
      &lt;parameter name="chart" class="java.awt.Image" isForPrompting="false"/&gt;
      &lt;background&gt;
          &lt;band splitType="Stretch"/&gt;
      &lt;/background&gt;
      &lt;title&gt;
          &lt;band height="48" splitType="Stretch"/&gt;
      &lt;/title&gt;
      &lt;pageHeader&gt;
          &lt;band height="35" splitType="Stretch"/&gt;
      &lt;/pageHeader&gt;
      &lt;columnHeader&gt;
          &lt;band height="14" splitType="Stretch"/&gt;
      &lt;/columnHeader&gt;
      &lt;detail&gt;
          &lt;band height="229" splitType="Stretch"&gt;
              &lt;image&gt;
                  &lt;reportElement x="162" y="13" width="200" height="200"/&gt;
                  &lt;imageExpression class="java.awt.Image"&gt;&lt;![CDATA[$P{chart}]]&gt;&lt;/imageExpression&gt;
              &lt;/image&gt;
              &lt;textField&gt;
                  &lt;reportElement x="37" y="61" width="100" height="20"/&gt;
                  &lt;textElement/&gt;
                  &lt;textFieldExpression class="java.lang.String"&gt;&lt;![CDATA[$P{testName}]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
          &lt;/band&gt;
      &lt;/detail&gt;
      &lt;columnFooter&gt;
          &lt;band height="112" splitType="Stretch"/&gt;
      &lt;/columnFooter&gt;
      &lt;pageFooter&gt;
          &lt;band height="76" splitType="Stretch"/&gt;
      &lt;/pageFooter&gt;
      &lt;summary&gt;
          &lt;band height="42" splitType="Stretch"/&gt;
      &lt;/summary&gt;
  &lt;/jasperReport&gt;
  </code></pre>