java - Report design not valid. Field not found Jasper Reports -
im trying create basic jasper report jrbeancollectiondatasource
. in there im having list of objects inside javabean.
public class course { private int id; private list<student> students; }
student object looks like
public class student { private string name; private int id; }
i want print student information inside report. how jrxml looks like
<subdataset name="dataset1" uuid="09015d96-ad5a-4fed-aa9e-19d25e02e205"> <field name="students" class="java.util.list"> <fielddescription><![cdata[students]]></fielddescription> </field> </subdataset> <field name="id" class="java.lang.integer"/> <field name="students" class="java.util.list"/> <field name="name" class="java.lang.string"/> <componentelement> <reportelement x="200" y="0" width="400" height="20"/> <jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemalocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printorder="vertical"> <datasetrun subdataset="dataset1"> <datasourceexpression><![cdata[new net.sf.jasperreports.engine.data.jrbeancollectiondatasource($f{students})]]></datasourceexpression> </datasetrun> <jr:listcontents height="20" width="400"> <textfield> <reportelement x="0" y="0" width="100" height="20"/> <box leftpadding="10"> <toppen linewidth="1.0"/> <leftpen linewidth="1.0"/> <bottompen linewidth="1.0"/> <rightpen linewidth="1.0"/> </box> <textelement/> <textfieldexpression><![cdata[$f{name}]]></textfieldexpression> </textfield> </jr:listcontents> </jr:list> </componentelement>
but when run im getting
net.sf.jasperreports.engine.design.jrvalidationexception: report design not valid : 1. field not found : name report design not valid : 1. field not found : name
im beginner jasper reports can please tell me doing wrong here.
you have define fields before using it.
in jrxml
, have 3 field defined students
in subdataset, id
, students
. haven't defined name
, using in jrxml
, that's why getting exception.
try defining name
, like
<field name="name" class="java.lang.string"/>
Comments
Post a Comment