How do we access parameters of a bean in Jasper Reports?
I have to display the data of a model (which is not a collection) in Jasper Reports.
I pass the model t
There are a couple steps to accomplish this.
1) Define your parameter: This will be the full package and class name of the type of the parameter. Something like:
2) Call the getter method for the value you want:
Add a textfield to the appropriate field. If I wanted to use the value for the method getId()
in my User class I my textfield would look like:
3) Set up the classpath in the iReport:
If you are using iReport to design your report you need to tell it where the compiled version of the com.mystuff.User class is located. If you are in eclipse you can just point it to your bin folder in your project, or if you have a jar of the compiled project you can point it to that. The classpath settings are located at Tools -> Options -> Classpath Tab
.