Chapter 24. JasperReports

Dbforms has included a servlet (StartReportServlet) to enable the use of JasperReports which is a "report-generating tool that has the ability to deliver rich content onto the screen, to the printer or into PDF, HTML, XLS, CSV and XML files".

The StartReportServlet will look for the report xml file in WEB-INF/custom/reports, or WEB-INF/reports.

If the report xml is newer then the jasper file report will be recompiled.

Example usage:

  1. with a simple goto button:

    <db:gotoButton
        destTable="web_parts"
        destination="/reports/Artikel"
    />
    
  2. for one record:

    <db:gotoButton
        destTable="web_parts"
        keyToDestPos="currentRow"
        destination="/reports/Artikel"
    />
    

In WEB-INF/web.xml, Servlet mapping must be set to handle all /reports by this servlet!!!

 <servlet>
    <servlet-name>startreport</servlet-name>
    <display-name>startreport</display-name>
     <servlet-class>org.dbforms.servlets.StartReportServlet</servlet-class>
 </servlet>
    
 <servlet-mapping>
    <servlet-name>startreport</servlet-name>
    <url-pattern>/reports/</url-pattern>
 </servlet-mapping>

Also, JasperReports.jar needs to be in your WEB-INF/lib directory.