Jump to content
We've recently updated our Privacy Statement, available here ×

lepiyao

Members
  • Posts

    1
  • Joined

  • Last visited

lepiyao's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. Hi, I'm always getting this exception 'javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/apache/commons/beanutils/NestedNullException' and the root cause 'java.lang.ClassNotFoundException: org.apache.commons.beanutils.NestedNullException' , everytime i run my function on my backing bean. And on the Console Log on my eclipse, it shown that 'JRBeanCollectionDataSource' that cause this exception. I'm using a simple commandButton (with ajax="false") in my.xhtml file to trigger the function on my backing bean. Any solution for this ? public void printPDF() throws JRException, IOException { List<PersonTest> dataSource = new ArrayList<>(); dataSource.add(new PersonTest("Tester","One")); dataSource.add(new PersonTest("Asdsa","Two")); dataSource.add(new PersonTest("Wasdsaw","Three")); String filename = "names.pdf"; String jasperPath ="/resources/report/report.jasper"; this.pdf(null, jasperPath, dataSource, filename); } public void pdf(Map<String, Object> params, String jasperPath, List<?> dataSource, String fileName) throws JRException, IOException { String relativeWebPath = FacesContext.getCurrentInstance().getExternalContext().getRealPath(jasperPath); File file = new File(relativeWebPath); JRBeanCollectionDataSource source = new JRBeanCollectionDataSource(dataSource, false); JasperPrint print = JasperFillManager.fillReport(file.getPath(), params, source); HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); response.addHeader("Content-disposition", "attatchment;filename=" + fileName); ServletOutputStream stream = response.getOutputStream(); JasperExportManager.exportReportToPdfStream(print, stream); FacesContext.getCurrentInstance().responseComplete(); }[/code]
×
×
  • Create New...