veera Posted April 4, 2007 Share Posted April 4, 2007 Dear Everyone, Greetings from Veera. The problem of mine would make u to brush up ur mind. The problem occurs when the Array List is passed to the jasper report from the Java Code. The Error is : net.sf.jasperreports.engine.JRException: Error retrieving field value from bean : $F{count} The real Code is : try { DBConnection db = new DBConnection(); Connection conn=db.connect(); Map parameters = new HashMap(); parameters.put("title","It is for testing"); JasperDesign jasperDesign = JasperManager.loadXmlDesign("F:\reports\districteligiblestatistics.jrxml"); JasperReport jasperReport = JasperManager.compileReport(jasperDesign); //String[] fields = new String[] { "districtname", "count"}; //HibernateQueryResultDataSource ds = new HibernateQueryResultDataSource(stat, fields); //JRBeanCollectionDataSource ds = new JRBeanCollectionDataSource(stat,fields); JRBeanCollectionDataSource beanCollectionDataSource = new JRBeanCollectionDataSource(stat); JasperPrint jasperPrint = JasperManager.fillReport(jasperReport, parameters, beanCollectionDataSource); byte[] bytes = JasperManager.runReportToPdf(jasperReport,parameters,conn); response.setContentType("application/pdf"); response.setContentLength(bytes.length); ServletOutputStream ouputStream = response.getOutputStream(); ouputStream.write(bytes, 0, bytes.length); ouputStream.flush(); } catch(Exception e) { System.out.println(e); } It would be very helpful, if I receive some help or suggestion. with regards, Veera 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