How do we access parameters of a bean in Jasper Reports?

前端 未结 1 1390
一向
一向 2021-02-06 17:44

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

1条回答
  •  梦如初夏
    2021-02-06 18:33

    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.

    0 讨论(0)
提交回复
热议问题