我需要将对象和列表传递给jrxml文件。我在JRBeanCollectionDataSource中发送参数映射和列表中的对象。我需要将对象发送给子报告。 1.什么应该是我应该用于该对象的类(因为它不是原始数据类型,而是用户定义的类型)。目前我使用java.lang.Object。 2.在我看到的大多数例子中,List或Map都被发送到子报告。我需要传递Object。将对象传递给jrxml,并将对象传递给其子报表
HashMap<String, Object> parameterMap = new HashMap<String, Object>();
parameterMap.put("json", taxYearReportBean.getTaxYearBean());
jasperPrint = JasperFillManager.fillReport(path, parameterMap, new JRBeanCollectionDataSource(taxYearReportBean.getSmallIssList()));
jp.add(jasperPrint);
类:
public class TaxYearBean{
Date startDate;
Date endDate;
String method;
List<LimitationBean> limitationList = new ArrayList<LimitationBean>();
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public List<LimitationBean> getLimitationList() {
return limitationList;
}
public void setLimitationList(List<LimitationBean> limitationList) {
this.limitationList = limitationList;
}
}
在子报表中(我想是在详细的乐队中)你喜欢只显示1 TaxYearBean?或者您想显示TaxYearBean?中的所有LimitationBean,您可以发布一些您尝试过的相关jrxml吗? –