This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Jasper Report blank

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have the following JSP page where I'm trying to view a report which is generated using the iReport tool. But when I try to generate the Report, the Report turns up with the template and it also fetches the number of records, but the records are not seen on the Report. Anybody knows why is this so??
Can anybody help me out?
I'm stuck up here!!!

the Following is the code written for it :

<%@ page errorPage="error.jsp" import="net.sf.jasperreports.engine.*,net.sf.jasperreports.engine.util.*,net.sf.jasperreports.engine.export.*,
java.util.Map,java.util.HashMap,java.sql.*,java.io.File,java.io.PrintWriter,oracle.jdbc.driver.OracleDriver"%>


<%
Connection conn = null;
String driver = "oracle.jdbc.driver.OracleDriver";
String hostName = "....";
String user = "abcde";
String password = "abcde";


File reportFile = new File(application.getRealPath("/reports/report.jasper"));

JasperReport jasperReport = (JasperReport)JRLoader.loadObject(reportFile.getPath());

Map parameters = new HashMap();
parameters.put("ReportTitle", "Address Report");
parameters.put("BaseDir", reportFile.getParentFile());


try{
Class.forName(driver);
conn = DriverManager.getConnection(hostName, user, password);

JasperPrint jasperPrint =JasperFillManager.fillReport(jasperReport,parameters,conn);

/*JasperPrint jasperPrint =
JasperFillManager.fillReport(
jasperReport,
parameters,
dataSource);*/

JRHtmlExporter exporter = new JRHtmlExporter();

StringBuffer sbuffer = new StringBuffer();
Map imagesMap = new HashMap();
session.setAttribute("IMAGES_MAP", imagesMap);
System.out.println("before exporter ");
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
System.out.println("JASPER_PRINT ");
exporter.setParameter(JRExporterParameter.OUTPUT_WRITER, out);
System.out.println("OUTPUT_WRITER ");
exporter.setParameter(JRHtmlExporterParameter.IMAGES_MAP, imagesMap);
exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "image.jsp?image=");
exporter.exportReport();
}catch(Exception e){
System.out.println(e.getMessage());
}

%>


Please do tell me where I'm wrong

thanks inadvance

Sherryl
 
girl power ... turns out to be about a hundred watts. But they seriuosly don't like being connected to the grid. Tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!