Hello Forum.
i have an array list in jsf bean that i want user to print via jasperreport.
i followed following steps.
1. use empty datasource in jasper report.
2. created Fields in jasper reports as those of my bean properties.
i tried both (Employee.name) and only name. (i dont know which one should be used)
3. then i compiled the report to employeeList.jasper and placed that in my
/reports/EmployeeReports/employeeList.jasper folder in jsf project.
I have then used following code to fill and show the pdf report to user
JRBeanCollectionDataSource dataSource = new JRBeanCollectionDataSource(this.srchdEmployeesList );
FacesContext facesContext = FacesContext.getCurrentInstance();
HttpServletResponse response = (HttpServletResponse)facesContext.getExternalConte xt().getResponse();
HashMap parameterMap = new HashMap();
JasperPrint jasperPrint = JasperFillManager.fillReport("/reports/EmployeeReports/employeeList.jasper", parameterMap, dataSource);
InputStream reportStream = facesContext.getExternalContext().getResourceAsStr eam("/reports/EmployeeReports/employeeList.jasper");
ServletOutputStream servletOutputStream = response.getOutputStream();
Class.forName("oracle.jdbc.driver.OracleDriver");
Session hibernateSession = null;
hibernateSession = HibernateUtils.currentSession();
connection = hibernateSession.connection();
facesContext.responseComplete();
response.setContentType("application/pdf");
response.setHeader("Content-disposition", "attachment;");
JasperRunManager.runReportToPdfStream(reportStream ,servletOutputStream, parameterMap, connection);
but the problem is, my report is not filling. Plz let me know where am i wrong. i will be obliged.
millions of thanks in advance and plz plz plz forgive my ignorance.