用JasperReport来生成html报表,为什么没反应
3个回答
展开全部
您好,很高兴为您解答:
String contextPath=request.getContextPath();
String fileName="C:/Program Files/Apache Software Foundation/Tomcat 5.0/webapps/Jasper/reports/AircraftReport.jasper";
String outFileName="C:/Program Files/Apache Software Foundation/Tomcat 5.0/webapps/Jasper/reports/AircraftReport.html";
//String outFileName="reports/AircraftReport.pdf";
try{
JRDataSource dataSource = createReportDataSource();
JasperPrint print=JasperFillManager.fillReport(fileName,new HashMap(),dataSource);
//JRExporter exporter=new JRPdfExporter();
JRExporter exporter=new JRHtmlExporter();
exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, outFileName);
exporter.setParameter(JRExporterParameter.JASPER_PRINT,print);
exporter.exportReport();
}catch(Exception e){
e.printStackTrace();
}
转载,仅供参考。
如果我的回答没能帮助您,请继续追问。
String contextPath=request.getContextPath();
String fileName="C:/Program Files/Apache Software Foundation/Tomcat 5.0/webapps/Jasper/reports/AircraftReport.jasper";
String outFileName="C:/Program Files/Apache Software Foundation/Tomcat 5.0/webapps/Jasper/reports/AircraftReport.html";
//String outFileName="reports/AircraftReport.pdf";
try{
JRDataSource dataSource = createReportDataSource();
JasperPrint print=JasperFillManager.fillReport(fileName,new HashMap(),dataSource);
//JRExporter exporter=new JRPdfExporter();
JRExporter exporter=new JRHtmlExporter();
exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, outFileName);
exporter.setParameter(JRExporterParameter.JASPER_PRINT,print);
exporter.exportReport();
}catch(Exception e){
e.printStackTrace();
}
转载,仅供参考。
如果我的回答没能帮助您,请继续追问。
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
String contextPath=request.getContextPath();
String fileName="C:/Program Files/Apache Software Foundation/Tomcat 5.0/webapps/Jasper/reports/AircraftReport.jasper";
String outFileName="C:/Program Files/Apache Software Foundation/Tomcat 5.0/webapps/Jasper/reports/AircraftReport.html";
//String outFileName="reports/AircraftReport.pdf";
try{
JRDataSource dataSource = createReportDataSource();
JasperPrint print=JasperFillManager.fillReport(fileName,new HashMap(),dataSource);
//JRExporter exporter=new JRPdfExporter();
JRExporter exporter=new JRHtmlExporter();
exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, outFileName);
exporter.setParameter(JRExporterParameter.JASPER_PRINT,print);
exporter.exportReport();
}catch(Exception e){
e.printStackTrace();
}
String fileName="C:/Program Files/Apache Software Foundation/Tomcat 5.0/webapps/Jasper/reports/AircraftReport.jasper";
String outFileName="C:/Program Files/Apache Software Foundation/Tomcat 5.0/webapps/Jasper/reports/AircraftReport.html";
//String outFileName="reports/AircraftReport.pdf";
try{
JRDataSource dataSource = createReportDataSource();
JasperPrint print=JasperFillManager.fillReport(fileName,new HashMap(),dataSource);
//JRExporter exporter=new JRPdfExporter();
JRExporter exporter=new JRHtmlExporter();
exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, outFileName);
exporter.setParameter(JRExporterParameter.JASPER_PRINT,print);
exporter.exportReport();
}catch(Exception e){
e.printStackTrace();
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询