A report is typically a short summary of the data that is evolved from a business operation. They are mostly in the form of a narrative, graph/chart form, or tabular form. Reports are mostly used to analyze a business operation to improve business or to keep track of transactions for auditing purposes.
Reporting tools are programs that help users and developers to visually design reports by using the Reporting Tools library. Reporting tools provide all the most important functions required to create nice reports in very less time through a rich and simple-to-use GUI. This can help people who do not know Reporting tools library to create simple reports and understand the XML syntax by taking a look at the generated code. This also helps skilled report designers to compose complex reports and thereby, saving a lot of time.
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