dgmanu Posted October 16, 2006 Share Posted October 16, 2006 hi 2 all... am using struts 1.2.8 , now am introducing to jasper reports , so wht i was doin is , ServletContext context = this.getServlet().getServletConfig().getServletContext(); Map parameters = new HashMap(); parameters.put("tare_detail",tare_detail); parameters.put("entry_date",entry_date); Connection con=null; File reportFile; try{ con=ConnectionJava.getConnection(); System.out.println("Connection establish...."); }catch(ClassNotFoundException ex){ System.out.println("*ClassNotFoundException**"+ex); }catch(SQLException se){ System.out.println("**SQLException*"+se); } try{ if(con!=null){ JasperCompileManager.compileReportToFile(context.getRealPath("/jsp/Reports/att3.jrxml")); reportFile = new File(context.getRealPath("/jsp/Reports/att3.jasper")); if (!reportFile.exists()) throw new JRRuntimeException("File att3.jasper not found. The report design must be compiled first."); JasperPrint jp=JasperFillManager.fillReport(context.getRealPath("/jsp/Reports/att3.jasper"),parameters,con); String destFileName=context.getRealPath("/jsp/Reports/att3.pdf"); JasperRunManager.runReportToPdfFile(context.getRealPath("/jsp/lReports/att3.jasper"),destFileName,parameters,con); List l=jp.getPages(); System.out.println("****compiled report SIZE*****"+ l.size()); if(l.size() != 0){ JasperPrintManager.printPages(jp,0,0,true); } System.out.println("**jp*"+jp); } }catch (JRException e){ e.printStackTrace(); } my problem is am not getting .jasper file after compilation. file not found exception is throwing, am using jasper1.2.6 , what is the problem here , please help me Thanking youPost edited by: dgmanu, at: 2006/10/16 10:32 Link to comment Share on other sites More sharing options...
dgmanu Posted October 17, 2006 Author Share Posted October 17, 2006 i got the answer... i had problem with JasperCompileManager.compileReportToFile(context.getRealPath("/jsp/Reports/att3.jrxml")); line of code, it was not creating .jasper file, for solution just check JasperCompileManager method in jasper 1.2.7 API Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now