错误信息: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的同志们能解答一下。。
我是用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的同志们能解答一下。。
解决方案 »
- jdbcTemplate与hibernateTemplate同时使用
- 求高手指点!!!!不用组件是否能直接得到file中的路径,如若不能如何使用组件得到路径!!!
- 自学(网站制作,FLASH,photoshop,3D)者,一定要看的网站。
- AXIS的Server.userException,刚学就受这么大的打击!
- dotcms用svn不能checkout ,急等
- tomcat部署问题!
- [300分]高分求基于weblogic和jbuilder能运行的pet store(如果能运行马上揭贴)
- 豁出去了 抛个100分! J2EE从何学起?
- EJB的server和client在同一台电脑上有意义吗?JSP+Bean+EJB结构是不是需要三台电脑才合理?
- 谁做过调用webservice接口查询数据库里的数据然后把数据以彩信形式发送给手机
- 在新浪微博中选中一段文子,就会提示转发到微博 怎么实现的,100分
- FTPClient.connect()的问题
html的
JRPdfExporter exporter = new JRPdfExporter();
pdf的你到底要什么样的啊?