2006 JR Open Discussion Posted August 22, 2006 Share Posted August 22, 2006 By: kaushal desai - kaushal_ndesai subreport not dispalyed..plz help... 2006-03-21 04:31hi.. i m not able to get subreport displayed with master report .... can any one help me out... Thanks in advance.... i have the following code written in Action class::: ArrayList detaillist; JasperReport subreport=null; if(detaillist.size() > 0) { JRDataSource datasource1 = new JRBeanCollectionDataSource(detaillist); JasperPrint jasperPrint; String temp = request.getRealPath("pages"+ "/reports//SubReport.jasper"; subreport = (JasperReport)JRLoader.loadObject(temp); jasperPrint=JasperFillManager.fillReport( subreport,parameters1,datasource1); StringBuffer pdfPath1 = new StringBuffer(request.getRealPath("pages/reports/jasperReportsPDFs")); String pdfFile1 = "subreport.pdf"; pdfPath1.append("/" + pdfFile1); JasperExportManager.exportReportToPdfFile(jasperPrint,pdfPath1.toString()); } // for master report.... // passing subreport as a parameter to master report parameters.put("subreport", subreport); jasperReportViewer.getPDFReport(request,response,datasource,parameters,reportFile,pdfPath.toString()); AND public void getPDFReport(HttpServletRequest request, HttpServletResponse response,JRDataSource dataSource, HashMap parameters, String reportXMLPath, String pdfFileName) { try { JasperReport jasperReport = JasperCompileManager.compileReport(reportXMLPath); JasperPrint jasperPrint = new JasperPrint(); jasperPrint = JasperFillManager.fillReport(jasperReport,parameters, dataSource); JasperExportManager.exportReportToPdfFile(jasperPrint,pdfFileName); } catch (JRException jre) { jre.printStackTrace(); } Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now