Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Jasper report problem

  Asked By: Ketan    Date: Dec 30    Category: Java    Views: 1117
  

I'm using Jasper for reporting.

I have a master report that containes just two subreports.

When i test master or subreports individually, everything is ok and 2 pages are printed.

But when i want to test all of them, a blank page is printed. I think because
parameters are not passed from master report to subreports.
I pass all of the fields from application to master and pass them from master to
subreports as params

Is there anyone that know what's going on?

This is my code :



private void printCard(List lst) {

Map parameters = new HashMap();
try{

InputStream frontInputStream = getClass().getResourceAsStream("Sub1.xml");
InputStream backInputStream = getClass().getResourceAsStream("Sub2.xml");
InputStream frontBackInputStream = getClass().getResourceAsStream("Master_Report.xml");

JasperDesign frontJasperDesign = JasperManager.loadXmlDesign(frontInputStream);
JasperDesign backJasperDesign = JasperManager.loadXmlDesign(backInputStream);
JasperDesign frontBackJasperDesign = JasperManager.loadXmlDesign(frontBackInputStream);

JasperReport frontJasperReport = JasperManager.compileReport(frontJasperDesign);
JasperReport backJasperReport = JasperManager.compileReport(backJasperDesign);
JasperReport frontBackJasperReport = JasperManager.compileReport(frontBackJasperDesign);
parameters.put("FrontCoverReport",frontJasperReport);
parameters.put("BackCoverReport",backJasperReport);

JRDataSource frontBackJRDataSource = new CustomDataSource(lst);
JasperPrint frontBackJasperPrint = JasperManager.fillReport(frontBackJasperReport, parameters, frontBackJRDataSource);
JasperPrintManager.printReport(frontBackJasperPrint, false);

}
catch(Exception ex) {
logExceptions(ex);
}
}

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Jasper report problem Or get search suggestion and latest updates.




Tagged: