Jump to content
Changes to the Jaspersoft community edition download ×

why subreport got blank ???


2005 IR Help

Recommended Posts

By: wimaya - wimaya

why subreport got blank ???

2004-11-29 20:46

Hi..

 

Iam a newbie using jasper report. I have a problem with my subreport. When I run my report using iReport, it was success. I can see both master report and master detail (both master and master detail have a query that I typed via iReport using

Report query form, my connection using

$P{REPORT_CONNECTION}).

 

But when I run the report from my jsp page (with pdf viewer), the master report visible but my subreport got blank. With pdf, I sent data from bean, and then I sent some subreport parameter.

I think I have a problem with connection to my subreport. I thought the subreport will run query that I typed before via iReport, but it didn't work

=(. Because it's not run the query, so it does not

any records to iterate.

 

I try used whenNoDataType="AllSectionsNoDetail" in my subreport template, but it didn't work too =(.

 

For information, i give my java code in my jsp page :

 

<%

System.setProperty(

"jasper.reports.compile.class.path",

application.getRealPath("/WEB-INF/lib/jasperreports-0.6.1.jar") +

System.getProperty("path.separator") +

application.getRealPath("/WEB-INF/classes/")

);

 

System.setProperty(

"jasper.reports.compile.temp",

application.getRealPath("/reports/")

);

 

DatabaseBridge databaseBridge = new DatabaseBridge();

databaseBridge.loadDatabase();

Connection connection = databaseBridge.needConnection();

 

JasperCompileManager.compileReportToFile(application.getRealPath("/reports/subReport.xml"));

JasperCompileManager.compileReportToFile(application.getRealPath("/reports/MasterReport.xml"));

 

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

 

parameters.put("BaseDir", reportFile.getParentFile());

 

 

byte[] bytes =

JasperRunManager.runReportToPdf(

reportFile.getPath(),

parameters,

new HomeService()

); // new HomeService is my object, the source data from bean

 

response.setContentType("application/pdf");

response.setContentLength(bytes.length);

ServletOutputStream ouputStream = response.getOutputStream();

ouputStream.write(bytes, 0, bytes.length);

ouputStream.flush();

ouputStream.close();

%>

 

Is there some missing code ??? Help me please...

Thank you for your attention...

 

Best Regards

Wimaya Septiningrum

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...