InputStream is1 = evalSummaryReportPage1.getResource().openStream(); //jrxml source Map reportParams1 = new HashMap(); // standard hashmap reportParams1.put(......) .. .. JasperDesign page1Design = JRXmlLoader.load(is1); JasperReport page1Compiled = JasperCompileManager.compileReport(page1Design); JasperPrint page1 = JasperFillManager.fillReport(page1Compiled, reportParams1); JRPdfExporter exporter = new JRPdfExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, page1); exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, filename); exporter.exportReport();
Until I found about
JREmptyDataSource
class. Apparently the fillReport() method of the JasperFillManager doesn't do shit when it doesn't has a third or the datasource parameter. It was bullshit because the same fillReport methods is overloaded and can be called with only two parameters. You can then compile with no problems or warnings. A warning would have been nice but no. I swear the Jasper devs did this on purpose just to fuck with me.So to fix this shit:
.. JasperDesign page1Design = JRXmlLoader.load(is1); JasperReport page1Compiled = JasperCompileManager.compileReport(page1Design); JasperPrint page1 = JasperFillManager.fillReport(page1Compiled, reportParams1, new JREmptyDataSource()); ..There, it now correctly generates the report.
zzzzzzzzz