Jump to content
We've recently updated our Privacy Statement, available here ×

How to run chartExample.jasper in webapp


aziziyazit

Recommended Posts

Hello guys!

I am in the urgent situation here. I have designed and compile my chartExample.jrxml to chartExample.jasper.

However when I run the jasper through my webapp it just display a blank/empty pdf file.

- I can display the *.txt, *.rtf and *.pdf however when run chartExample that contain chart, it appeared blank.

 

Azizi Yazit

Code:
...else if(formBean.getFmt().equals("chartP")){                    response.setContentType("application/pdf");                    response.addHeader("Content-disposition", "attachment; filename=" + filename.toString() + ".pdf");                                       try{                        JasperReport jasperReport =       (JasperReport)JRLoader.loadObject(getClass().getClassLoader().getResourceAsStream(reportName));                        JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, HibernateUtil.currentSession().connection());                                               JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());                    }                    catch (JRException e)                    {                      e.printStackTrace();                    }                }
Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

@Lucian

 

Thanks for the quick reply. My problem has been solved. It appeared blank because wrong input in parameter inside iReport.

 

If I am wrong, please correct me. If report appear blank it's because wrong user input or input from user is not suit with query?

 

I have do googling a lots, and I found that, if we want generate a chart image, we better use JFreeChart through java code. And if we want report contains chart, we can use jasper report through iReport.

 

Azizi Yazit.

Link to comment
Share on other sites

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...