错误信息:net.sf.jasperreports.engine.JRException: No output specified for the exporter.
我是用SSH框架中使用报表。
调用报表代码:public void applyStatPrint(InfoStatAction infoStatAction) throws Exception {
ApplicationContext context = new ClassPathXmlApplicationContext("/spring/applicationContext-db.xml");
DataSource dataSource = (DataSource) context.getBean("dataSource");
String reportPath ="..";
Map parameters = new HashMap();
java.util.Date makedate = infoStatAction.getErtificateTime();
parameters.put("makedate",makedate);
try {
Connection connection=null;
    connection = dataSource.getConnection();
JasperReport jasperReport = (JasperReport) JRLoader.loadObject(infoStatAction.getHttpRequest().getRealPath("/page/train/infoStat/report/ApplyStat.jasper"));
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, connection);
infoStatAction.getHttpResponse().reset();
infoStatAction.getHttpResponse().setContentType("text/html; charset=GBK");
PrintWriter writer = infoStatAction.getHttpResponse().getWriter();
// 使用JRHtmlExporter导出Html格式
JRPdfExporter exporter = new JRPdfExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_WRITER, writer);
// 报表边框图片设置"report/image?image=",report为你的报表及PX图片所在目录
//exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "report/image?image=");
// 报表边框图片设置IS_USING_IMAGES_TO_ALIGN,Boolean.FALSE,不使用图片
exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, Boolean.FALSE);
exporter.setParameter(JRExporterParameter.CHARACTER_ENCODING, "GBK");
// 导出
exporter.exportReport();
}catch(Exception ces){
ces.printStackTrace();
}
}
请哪位好心人,帮忙解答一下。。本人实在不知道怎么使用报表。。在网上也找到很多不同的信息。没有符合的。还望CSDN的同志们能解答一下。。