• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to display jasper report in jsp

 
shankar valiinaykam
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

How do I display jasper report in jsp?

<form name='reportform' method='POST'>
<%
JasperDesign jasperDesign = JRXmlLoader.load("C:\\apache-tomcat-5.5.17\\webapps\\ROOT\\redcals\\Edcal_report.jrxml");
JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
Connection conn = new DBUtility().getConnection();
ByteArrayOutputStream baos =new ByteArrayOutputStream();
response.setContentType("application/pdf");
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, null, conn);
net.sf.jasperreports.engine.JasperExportManager.exportReportToPdfStream(jasperPrint,baos);
response.setContentLength(baos.size());
ServletOutputStream out1 = response.getOutputStream();
baos.writeTo(out1);
out1.flush();
conn.close();
%>
</form>

I am spinning wheels for whole day on this issue. Kindly help me.

Thanks,
Sankar
 
Chetan Parekh
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you getting any errors?

You should remember that you required PDF plug-in installed and integrated with your browser to display PDF data.
 
shankar valiinaykam
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have pdf plug-in
 
Chetan Parekh
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
are you getting any error?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic