jluix Posted June 19, 2010 Share Posted June 19, 2010 Hi! This is my first post in this forum.I'd appreciate a lot a bit of help.I've been trying to create my first testing bean based report using jasper+ireport under jdeveloper for a while.This is the report I've prepared:<?xml version="1.0" encoding="UTF-8"?><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report4" language="groovy" pageWidth="792" pageHeight="612" orientation="Landscape" columnWidth="752" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="0"/> <field name="nombre" class="java.lang.String"/> <background> <band splitType="Stretch"/> </background> <title> <band height="79" splitType="Stretch"/> </title> <pageHeader> <band height="35" splitType="Stretch"/> </pageHeader> <columnHeader> <band height="61" splitType="Stretch"/> </columnHeader> <detail> <band height="125" splitType="Stretch"> <textField> <reportElement x="107" y="37" width="100" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><$F{nombre}></textFieldExpression> </textField> </band> </detail> <columnFooter> <band height="45" splitType="Stretch"/> </columnFooter> <pageFooter> <band height="54" splitType="Stretch"/> </pageFooter> <summary> <band height="42" splitType="Stretch"/> </summary></jasperReport> I've developed this pojo bean class: public class Persona{ private String nombre; public Persona(String pnombre){ nombre=pnombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String getNombre() { return nombre; } } ---After this, I've used the next code inside my program: ArrayList al = new ArrayList(); al.add(new Persona("Pedro")); al.add(new Persona("Juan")); JRBeanCollectionDataSource ds = new JRBeanCollectionDataSource(al,false); try { JasperReport jasperReport = JasperCompileManager.compileReport("~/report4.jrxml"); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(),ds); JasperExportManager.exportReportToPdfFile(jasperPrint, "~/report4.pdf"); } catch (JRException e) { System.out.println("error "); }When executing this code, at the line marked in yellow, jdeveloper throws an exception saying: Unknown property nombre.Error retrieving field value from bean : nombreI've look on the Internet (and I've tried a lot of things) but I haven't found any solution to this. I'm getting mad.Please, Help me. Link to comment Share on other sites More sharing options...
thangalin Posted June 21, 2010 Share Posted June 21, 2010 Take a look here: http://stackoverflow.com/questions/894587/understanding-jasperreports-and-jrbeancollectiondatasource Link to comment Share on other sites More sharing options...
swarupap Posted April 25, 2012 Share Posted April 25, 2012 Hi,I also have the same problem.I tried with the above link but i didnt get any solution.If you get any solution can you please share it to my mail id.swarupa340@gmail.com this is my mail id. Thank You. Link to comment Share on other sites More sharing options...
Java_Jasper Posted April 25, 2012 Share Posted April 25, 2012 Please see my post, all development was done in Jdeveloper. http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=97606 Cheers! 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