To integrate ONEWEB with reporting tools we need to implement three components.
Servlet to generate output document.
Develop report form.
Create an entity to search data and pass them to the servlet report generator.
To understand the reporting architecture on ONEWEB please see the picture below
The following example explains how to generate a sample PDF report from jasper(.jrxml) with servlet java code
Step 1
Prepare external jar files. (Note : x.x.x is version that project use)
commons-beanutils-x.x.x.jar
commons-collections-x.x.x.jar
commons-digester-x.x.jar
commons-logging-x.x.jar
groovy-all-x.x.x.jar (NOTE : If the report language is default Groovy. It is optional)
iText-x.x.x.jar(NOTE : For PDF Exports)
jasperreports-x.x.x.jar
poi-x.x.jar(for excel exports)
jfreechart-x.x.x.jar
Step 2
Develop report form using the reporting tools: iReport or Crystal report. This example uses iReport to create a report form. Check the links below for more information :
For iReport : https://community.jaspersoft.com/wiki/ireport-designer-tutorials-help
For Crystal Report : https://www.tutorialspoint.com/crystal_reports/
For jasper report : https://www.tutorialspoint.com/jasper_reports/
Step 3
Develop servlet to call Jasper report and generate a report in output formats such as PDF or Excel. This example code generates a report in PDF format. Create a simple servlet, which creates a connection using the JNDI name: “jdbc/application” and then calls Jasper
Pass the connection to select data to generate a report and return the report file to the client-side without saving the file on the server.
Step 4
Create an entity to call the servlet to generate the report.
Inside Entity use Entity action and include JavaScript to prepare the function to call the servlet using the URL - http://host:port/report?name=reportName&REPORT_PARAMETER=zzz