I'm new to JasperReports and I want to get report preview using JasperViewer in web application.
Is this possible or any other viewing method in web application (without PDF and XLSX)?
I'm new to JasperReports and I want to get report preview using JasperViewer in web application.
Is this possible or any other viewing method in web application (without PDF and XLSX)?
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();