Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Unable to print the report using Jasper

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
getting any errors on console?
 
reply
    Bookmark Topic Watch Topic
  • New Topic