JasperReports: How to call the report in jsp page

前端 未结 6 609
迷失自我
迷失自我 2020-11-27 21:02

I made one jasper report using iReport 3.7.4 version, now i have to use that or call that report in my java application where i am using servlets, jsp and strut

6条回答
  •  情歌与酒
    2020-11-27 21:35

    This is a different way of doing the same.

        JasperReport jasperReport;
        JasperPrint jasperPrint;
        Map param = new HashMap();
        try{
            String sourceFileName = ".jrxml";
            jasperReport = JasperCompileManager.compileReport(sourceFileName);
            jasperPrint = JasperFillManager.fillReport(jasperReport,param,new JRBeanCollectionDataSource(getDetails()));
            JasperExportManager.exportReportToPdfFile(jasperPrint, ".pdf");
        }
        catch(Exception e){
        }
    

提交回复
热议问题