JasperReports: Passing in a list of lists as a datasource

前端 未结 3 640
耶瑟儿~
耶瑟儿~ 2020-12-21 07:03

I need to populate a few subreports with lists of different objects. Basically lets say i have the following:
Subreport on used Vehicles
Subreport on new Vehicles<

3条回答
  •  天命终不由人
    2020-12-21 07:51

    i was the same problems with you and i solved it using the tag List of jasper, i used datasource in my class java, for example: parameter.put("MyList", new JRBeanCollectionDataSource(ListObjects)); in JRXML

    In palete of Jasper, choose the tag LIST and drag and drop in your relatory after choose

    • create new dataset
    • create new dataset from a connection… ...
    • in data adapter choose new data adapter - collection of javabeans
    • use a JRDatasource expression
    • go in lis of parameters and choose you list op objects (MyList)

    now go to outline of jasper and - dataset properties - edit and query filter ... ... - javabean - search you class (I using eclipse, so it's easy to search my class) - add fields to use

提交回复
热议问题