| Author |
Unable to print the report using Jasper
|
Shrikant Kulkarni
Ranch Hand
Joined: May 10, 2005
Posts: 42
|
|
Hi All, I am using jasper reports for generating some reports. I have written one "JasperReport.jrxml" file for report to display. In "html.jsp" file i have written code with generates reports in html format. the code in html.jsp is as below ================================================================== File reportFile = new File(application.getRealPath("/reports/JasperReport.jasper")); if (!reportFile.exists()) throw new JRRuntimeException("File JasperReport.jasper not found. The report design must be compiled first."); JasperReport jasperReport = (JasperReport)JRLoader.loadObject(reportFile.getPath()); Map parameters = new HashMap(); parameters.put("ReportTitle", "Jasper Report"); JasperReportDataSource ob =new JasperReportDataSource(); //rs is Resultset of my query ResultSet rs = ob.getResultSet(); JRResultSetDataSource jr = new JRResultSetDataSource(rs); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, jr); JRHtmlExporter exporter = new JRHtmlExporter(); session.setAttribute(ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE, jasperPrint); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_WRITER, out); exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "../servlets/image?image="); exporter.exportReport(); ========================================================================== When i run this application the report what i generated as just a blank even the static fields mention in .jrxml file are not displayed. Can any one pls help me in this regard. Shrikant
|
 |
Chetan Parekh
Ranch Hand
Joined: Sep 16, 2004
Posts: 3636
|
|
|
getting any errors on console?
|
My blood is tested +ve for Java.
|
 |
 |
|
|
subject: Unable to print the report using Jasper
|
|
|