如何使用liferay在页面jsp中加载文件.jrxml?

时间:2015-10-09 02:14:20

标签: jasper-reports liferay

我想在jsp页面上显示jasper报告。我该怎么办? 我尝试这个代码,但它不起作用,并得到一些问题:

    String jrxmlFile = "D://Data_DuongNgocThanh//BaoCao557//report1.jrxml";
    InputStream input = new FileInputStream(new File(jrxmlFile));
    System.out.println("Load lan 1");
    JasperReport jasperReport = JasperCompileManager.compileReport(input);
    JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(),new JREmptyDataSource());
    System.out.println("Load xong roi");
    //JasperExportManager.exportReportToPdfStream(jasperPrint, OutputStream("sample.pdf"));
    response.getOutputStream().flush();
    response.getOutputStream().close();

错误

  

org.apache.jasper.JasperException:在第38行处理JSP页面/view.jsp时发生异常

错误行:

  JasperReport jasperReport = JasperCompileManager.compileReport(input);

我需要另一种方法或解决方案。

更新

06:42:54,980 ERROR [PortletRequestDispatcherImpl:108] org.apache.jasper.JasperException: An exception occurred processing JSP page /view.jsp at line 42

39:         String jrxmlFile = "D:/Data_DuongNgocThanh/BaoCao557/report1.jrxml";
40:         InputStream input = new FileInputStream(new File(jrxmlFile));
41:         System.out.println("Load lan 1");
42:         JasperReport jasperReport = JasperCompileManager.compileReport(input);
43:         JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(),new JREmptyDataSource());
44:         System.out.println("Load xong roi");
45:         //JasperExportManager.exportReportToPdfStream(jasperPrint, OutputStream("sample.pdf"));


Stacktrace:
org.apache.jasper.JasperException: An exception occurred processing JSP page /view.jsp at line 42

39:         String jrxmlFile = "D:/Data_DuongNgocThanh/BaoCao557/report1.jrxml";
40:         InputStream input = new FileInputStream(new File(jrxmlFile));
41:         System.out.println("Load lan 1");
42:         JasperReport jasperReport = JasperCompileManager.compileReport(input);
43:         JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(),new JREmptyDataSource());
44:         System.out.println("Load xong roi");
45:         //JasperExportManager.exportReportToPdfStream(jasperPrint, OutputStream("sample.pdf"));

0 个答案:

没有答案