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

How to represent the java bean property through arraylist in jasper reports


aypatel90

Recommended Posts

I have successfully created a report template which works fine for jdbc connection as datasource. Now I am using javabean as datasource and I have only one doubt with me.

I have two bean classes Bean and Bean1. Now in Jasper reports when I use TextField like below it shows me an error

Caused by: groovy.lang.MissingPropertyException: Exception evaluating property 'totalDays' for java.util.ArrayList, Reason: groovy.lang.MissingPropertyException: No such property: totalDays for class: Model.Bean1

The Textfield Expression is

<textFieldExpression><![CDATA[$F{list}.totalDays]]></textFieldExpression>

 

I have also tried with $P{list}.totalDays by passing arraylist in map to main report's parameter like this map.put("List",list); but it failed...

The two bean classes are....

public class Bean implements Serializable
{
    private String employeeName;   
    private List<Bean1> list;
    
    
    public Bean(String string, List<Bean1> list)
    {
        this.employeeName=string;   
        this.list=list;
    }    
    
    
    public List<Bean1> getList() {
        return list;
    }

    public void setList(List<Bean1> list) {
        this.list = list;
    }
    
    public Bean()
    {
        
    }

    public void setEmployeeName(String employeeName) {
        this.employeeName = employeeName;
    }
    
    public String getEmployeeName() {
        return employeeName;
    }
   
}

 

And the Bean1 looks like

public class Bean1
{
    private String toatlDays;
    private String workingDays;
    private String presentDays;
    private String absentDays;
    private String dummyData;
    
    public Bean1(String string2, String string3, String string4,
            String string5, String string6)
    {        
        this.toatlDays=string2;
        this.workingDays=string3;
        this.presentDays=string4;
        this.absentDays=string5;
        this.dummyData=string6;    
    
    }    
    public Bean1()
    {
        
    }
    
    
        public String getToatlDays()
        {
            return toatlDays;
        }
        public void setToatlDays(String toatlDays)
        {
            this.toatlDays = toatlDays;
        }    
        public String getWorkingDays()
        {    
            return workingDays;
        }
        public void setWorkingDays(String workingDays)
        {
            this.workingDays = workingDays;
        }    
        public String getPresentDays()
        {
            return presentDays;
        }
        public void setPresentDays(String presentDays)
        {
            this.presentDays = presentDays;
        }
        public String getAbsentDays()
        {
            return absentDays;
        }
        public void setAbsentDays(String absentDays)
        {    
            this.absentDays = absentDays;
        }    
        public String getDummyData()
        {
            return dummyData;
        }
        public void setDummyData(String dummyData)
        {
            this.dummyData = dummyData;
        }
    
    
}
 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...