JasperReports:通过jsp代码编译报表时从文件加载对象时出错

时间:2010-07-07 06:44:47

标签: java reporting jasper-reports

我创建了主报告和子报告。我已经在jsp中编写代码来调用主报告但是它给出了一个错误。

Error Loading object from file: "path where the sub report resides". 

如果我做错了,请帮帮我。

jasperdesign = JasperManager.loadXmlDesign(getServletConfig()
        .getServletContext().getRealPath("/reports/VoucherReport.jrxml"));
jasperReport = JasperCompileManager.compileReport(jasperdesign);

HashMap map = new HashMap();
map.put("myParam", voucherId);

jasperPrint = JasperFillManager.fillReport(jasperReport, map, con);
JasperManager.printReportToPdfFile(jasperPrint, getServletConfig()
        .getServletContext().getRealPath("/reports/myReport.pdf"));

它在jasper print上抛出异常。请帮帮我。我需要一个解决方案,这个凭证报告是一个主报告,我还需要编译子报告。

1 个答案:

答案 0 :(得分:0)

我的网络应用程序和子报告的路径也存在一些问题。查看* .jrxml文件并检查它是否使用子报表的绝对路径。对我来说,它有助于将我的应用程序的RealPath发送到带有参数的报告中。此参数用于子报表的位置。

相关问题