Problems Ireport and jasper reports SUBREPORTS
I designed a mainReport and a subreport, but I can�t see the subreport when executing the mainReport.
I use the subreport Tool, and subreport's absolute path.
The subreport doesn't need any connection or paremeters, because it's a Static text.
The two Java source codes:
First:*
JasperReport jasperReport;
JasperPrint jasperPrint;
Map parameters = new HashMap();
ReportSource reportSource=new ReportSource(con);
jasperReport = JasperCompileManager.compileReport(
"c:/java/workspace/JasperOskar/conf/MainReport.jrxml");
jasperPrint = JasperFillManager.fillReport(jasperReport, parameters,reportSource);
JasperExportManager.exportReportToPdfFile(
jasperPrint,"c:/java/workspace/JasperOskar/conf/mainReport.pdf");
Second:*
JasperReport jasperReport;
JasperPrint jasperPrint;
Map parameters = new HashMap();
ReportSource reportSource=new ReportSource(con);
JasperReport masterReport = null;
masterReport = (JasperReport) JRLoader.loadObject("c:/java/workspace/JasperOskar/conf/MainReport.jrxml");
JasperReport subReport1 = null;
subReport1 = (JasperReport) JRLoader.loadObject("c:/java/workspace/JasperOskar/subReport.jrxml");
Map masterParams = new HashMap();
masterParams.put("SUBREPORT",subReport1);
JasperPrint masterPrint = null;
masterPrint = JasperFillManager.fillReport(masterReport, masterParams,reportSource );
JasperExportManager.exportReportToPdfFile(
masterPrint, "c:/java/workspace/JasperOskar/conf/MainReport.pdf");
JasperViewer.viewReport(masterPrint, false);
Please help me as I need a solution.
Thanks.