<%
File reportFile = new File(application.getRealPath("/reports/WebappReport.jasper"));
if (!reportFile.exists())
throw new JRRuntimeException("File WebappReport.jasper not found. The report design must be compiled first.");
JasperReport jasperReport = (JasperReport)JRLoader.loadObject(reportFile.getPath());
Map parameters = new HashMap();
parameters.put("ReportTitle", "Address Report");
parameters.put("BaseDir", reportFile.getParentFile());
JasperPrint jasperPrint =
JasperFillManager.fillReport(
jasperReport,
parameters,
new WebappDataSource()
);
JRHtmlExporter exporter = new JRHtmlExporter();
session.setAttribute(ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE, jasperPrint);