Problem displaying Jasper reports in struts web app - PLEASE HELP!
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Mike_Parker
Posted On:   Tuesday, July 29, 2003 04:20 PM

I am currently developing my first struts-based web application. So far so good until I tried to display a Jasper report - mass headaches! I have used iReport to produce a compiled .jasper file but I cannot seem to access it at all. I am getting file not found errors all over the place! My code (version 565!) is: File reportFile = new File("/reports/TestThree.jasper"); String path = reportFile.getPath(); //tried getAbsolutePath() Map parameters = new HashMap(); parameters.put("TourID", "INV 55"); JasperPrint jasperPrint = JasperManager.fillReport ( path,parameters, conn); JasperManager.printReportToPdfFile(jasperPrint, "T   More>>

I am currently developing my first struts-based web application. So far so good until I tried to display a Jasper report - mass headaches!


I have used iReport to produce a compiled .jasper file but I cannot seem to access it at all.
I am getting file not found errors all over the place!
My code (version 565!) is:


File reportFile = new File("/reports/TestThree.jasper");
String path = reportFile.getPath(); //tried getAbsolutePath()

Map parameters = new HashMap();

parameters.put("TourID", "INV 55");

JasperPrint jasperPrint = JasperManager.fillReport ( path,parameters, conn);

JasperManager.printReportToPdfFile(jasperPrint, "TestThree.pdf");



My folder (records) is directly under the root folder.
Does anyone have any suggestions or any example code of running a Jasper report in the struts environment?


Cheers

   <<Less

Re: Problem displaying Jasper reports in struts web app - PLEASE HELP!

Posted By:   Anchal_Agarwal  
Posted On:   Wednesday, July 30, 2003 02:32 AM

Hi,

Try this in your jsp..






" />









In myAction class assign the pdf file name to 'pdfFile' field of myActionForm.

Now forward the request to the JSP.


Hope this is what u r looking for!

Rgds,

Anchal.

About | Sitemap | Contact