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

pandabodoh

Members
  • Posts

    5
  • Joined

  • Last visited

pandabodoh's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. I also need the same solution as you do can u share it with me. I just cant getFields from my datasource. below is my code. after that I got this error:Error retrieving field value from bean : name Code://How I declare my class like thisclass Person implements Serializable{private String name;public Person(String str){this.name=str;}public String getname(){return this.name;}public String setname(String str){this.name= str;}}try {Person Person = new Person("Tom");List<Person> persons = new ArrayList<Person>();persons.add(Person);JRBeanCollectionDataSource​ conn = new JRBeanCollectionDataSource​(persons);JasperPrint print;print = JasperFillManager.fillRepo​rt(jr, new HashMap(), conn);}Catch(Exception ex){System.out.println(ex.getMessage());}
  2. The error I am having is "Error retrieving field value from bean : firstName"
  3. I also got include this code ....... but I think is the jxml code that regarding to field is the problem I have. Code:tring str ="C:\\Users\\PAN\\Documents\\NetBeansProjects\\DesktopApplication1\\src\\desktopapplication1\\newReport.jrxml";try{ JasperReport jr=JasperCompileManager.compileReport(str); //Connection c =null; JasperPrint print; print = JasperFillManager.fillReport(jr, new HashMap(), conn);}
  4. Can someone help me in using JRBeanCollectionDataSource? I am quite new to this ireport. I want to construct a list of Person and use it as a Connection source..... But I think my problem is not with the code but with jxml field..... the field is not loading from my datasource...... I wonder how do I solved it. Plz help me with jxml code.... I just want to load my datasource into the field Code:class Person { private String firstName; private String lastName; public Person() { } public Person(String firstName, String lastName) { this.firstName = firstName; this.lastName = lastName; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; }} Person Person = new Person("yahoo","google"); List<Person> persons = new ArrayList<Person>(); persons.add(Person); JRBeanCollectionDataSource conn = new JRBeanCollectionDataSource(persons);/*jxml code*/<?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="report name" pageWidth="595" pageHeight="842" columnWidth="535" 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"/> <import value="net.sf.jasperreports.engine.*"/> <import value="java.util.*"/> <import value="net.sf.jasperreports.engine.data.*"/> <field name="firstName" 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"/> </detail> <columnFooter> <band height="45" splitType="Stretch"/> </columnFooter> <pageFooter> <band height="54" splitType="Stretch"/> </pageFooter> <summary> <band height="42" splitType="Stretch"/> </summary></jasperReport>
×
×
  • Create New...