使用JasperViewer或Web应用程序中的其他内容查看报告 [英] View report using JasperViewer or something else in web application
本文介绍了使用JasperViewer或Web应用程序中的其他内容查看报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是 JasperReports 的新手,我想在网络应用程序中使用 JasperViewer 进行报告预览。
I'm new to JasperReports and I want to get report preview using JasperViewer in web application.
这是可能的还是Web应用程序中的任何其他查看方法(没有PDF和XLSX)?
Is this possible or any other viewing method in web application (without PDF and XLSX)?
推荐答案
您可以导出到html文件然后你可以把它作为输出或ServletOutputStream发送,在框架中显示它
You can export to html file then you can send it as output or ServletOutputStream , show it in a frame
String htmlpath="E:/JASPER/OUTPUT/test_jasper.html";
JasperDesign jasperDesign = JRXmlLoader.load(inputStream);
JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, conn);
JasperExportManager.exportReportToHtmlFile(jasperPrint,htmlpath);
InputStream in=new FileInputStream(htmlpath);
int len = -1;
byte[] byt = new byte[1024];
ServletOutputStream outputStream = response.getOutputStream();
while((len = in.read(byt)) != -1){
outputStream.write(byt, 0, len);
}
outputStream.flush();
outputStream.close();
这篇关于使用JasperViewer或Web应用程序中的其他内容查看报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文