public void showApplicantCountVsJobBoardsSimpleReport(Collection<ApplicantCountVsJobBoardsDTO> applicantCountVsJobBoardsList,HttpServletRequest request) throws ColumnBuilderException,ClassNotFoundException, JRException {
initStyles();
FastReportBuilder drb = new FastReportBuilder();
setTitleProperties(drb,"Job Board by Company and Job Title");
reportTitle = "Job-Board-by-Company-and-Job-Title";
DynamicReport dr = createApplicantCountVsJobBoardsSimpleReport(drb, applicantCountVsJobBoardsList);
jp = DynamicJasperHelper.generateJasperPrint(dr, new ClassicLayoutManager(), new JRBeanCollectionDataSource(applicantCountVsJobBoardsList));
request.getSession().setAttribute("JasperPrintObject", jp);
request.getSession().setAttribute("ReportName", reportTitle);
displayReport(request, 0);
}
private DynamicReport createApplicantCountVsJobBoardsSimpleReport(FastReportBuilder drb, Collection<ApplicantCountVsJobBoardsDTO> applicantCountVsJobBoardsList) {
AbstractColumn columnCompanyName = setStringColumnProperties("companyName","Company Name",100);
drb.addColumn(columnCompanyName);
AbstractColumn columnJobTitle = setStringColumnProperties("jobName","Job Title",200);
drb.addColumn(columnJobTitle);
AbstractColumn columnTotal = setStringColumnProperties("totalApplicantForJob","Total",100);
drb.addColumn(columnTotal);
return drb.build();
}
public class ApplicantCountVsJobBoardsDTO {
private String companyName;
private String jobName;
private Integer totalApplicantForJob;
private HashMap<String, Integer> jobBoard;
public String getCompanyName() {
return companyName;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
public String getJobName() {
return jobName;
}
public void setJobName(String jobName) {
this.jobName = jobName;
}
public Integer getTotalApplicantForJob() {
return totalApplicantForJob;
}
public void setTotalApplicantForJob(Integer totalApplicantForJob) {
this.totalApplicantForJob = totalApplicantForJob;
}
public HashMap<String, Integer> getJobBoard() {
return jobBoard;
}
public void setJobBoard(HashMap<String, Integer> jobBoard) {
this.jobBoard = jobBoard;
}
}
I don't have any idea to add the jobBoard items to the report.. Each item in the jobBoard object will be a column in my report. Please help me. I am new to Jasper. :(
I am using net.sf.jasperreports
and ar.com.fdvs.dj
jars
在这种情况下,您将必须使用ireport工具的子报表功能,在该功能中,您将哈希图作为数据源传递,然后在该报表中决定报表的布局和设计。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.