0
    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;
    }
}

我不知道将 jobBoard 项目添加到报告中。jobBoard 对象中的每个项目都将成为我报告中的一列。请帮我。我是贾斯珀的新手。:(

我正在使用net.sf.jasperreportsar.com.fdvs.dj罐子

4

1 回答 1

0

在这种情况下,您将不得不使用 ireport 工具的子报表功能,其中您将 hashmap 作为数据源传递,然后在该报表中您决定报表的布局和设计。

于 2013-03-26T05:54:58.087 回答