Jump to content
JasperReports Library 7.0 is now available ×

Sample code of streaming into a JSP


2004 IR Help

Recommended Posts

By: AleXXandra - alexxandra

Sample code of streaming into a JSP

2005-06-01 02:39

Hi, could you post me an easy code sample to generate into a JSP, a PDF (streaming) page from a .jasper file ?

 

Thank you in advantage,

 

AleX

 

 

 

 

By: Bogdan - cecenu

RE: Sample code of streaming into a JSP

2005-06-01 06:11

I don't fully understand your question (because of my English) but I thing this would help you:

 

In the doGet or doPost method do something like this:

 

ByteArrayOutputStream baos;

 

JasperExportManager.exportReportToPdfStream(jp,baos);

/* where jp is a JasperPrint object created with the JasperFillManager.fillReport(list of params) method */

response.reset();

response.setContentType("application/pdf");

response.setHeader("Expires", "0");

response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");

response.setHeader("Pragma", "public");

response.setContentLength(baos.size());

 

OutputStream out = response.getOutputStream();

 

baos.writeTo(out);

baos.close();

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...