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

executing jasper report from jsp page


Buela

Recommended Posts

I have jrxml file which retrieves data from mysql database.I would like to run this file using jsp page.When am executing jsp page jrxml file should print data in pdf format .Here is my code

                  File reportFile = new File(application.getRealPath("report/report1.jasper"));//report_name.jasper file
                Map parameters = new HashMap();
                byte[] bytes = 
    JasperRunManager.runReportToPdf(reportFile.getPath(),parameters, conn);                             
                response.setContentType("application/pdf");
                response.setContentLength(bytes.length);
                ServletOutputStream outStream = response.getOutputStream();
                outStream.write(bytes, 0, bytes.length);
                outStream.flush();
                outStream.close();
         while executing its giving exception:    
            org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 38
       38:byte[] bytes = JasperRunManager.runReportToPdf(reportFile.getPath(),parameters, conn);
             Can anybody please help me how to resolve this.

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

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