We use something like this for our pdf reports (in a servlet):
<code>
byte[] bytes = JasperRunManager.runReportToPdf(reportFile.getPath(),
jasperParams, connection);
response.setContentType("application/pdf");
response.setContentLength(bytes.length);
ServletOutputStream ouputStream = response.getOutputStream();
ouputStream.write(bytes, 0, bytes.length);
ouputStream.flush();
</code>
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 20 July 2005 16:12
To: [email protected]
Subject: [CTJUG Forum] Help Needed with JasperReports
Hi all,
Thanks for your help with my previous question. I have now produced a
report using iReport for JasperReports; it compiles and runs perfectly
from iReport but I am now having trouble running the report from a JSP
page.
What I'm doing in the JSP page at the moment:
Create my parameters map and establish a connection with the database
Use JasperFillManager.fillReport to fill the report from the .jasper
report file (compiled with iReport).
Now I have a problem. What I want to do is run the report and export
the results to HTML, then use out.print() to print out the result of
the report. Unfortunately, looking at the methods available in
JasperPrintManager and JasperRunManager, I can't see what I need. I
don't really understand the difference between the "Print" and "Run"
classes either, which doesn't help.
I want to do it this way because the report will only be one part of
the page that the user sees; I have another page with menus and so on
that just has an include directive to the page that runs the report.
Can anyone help? Either an explanation of the appropriate method or a
suggestion on what I should be doing if I'm going about this the wrong
way would be appreciated.
Regards,
Fritz jnr