From: David J. <tha...@gm...> - 2010-05-02 17:02:45
|
Hi, When developing a JasperReports integration for Oracle's ADF, I wanted to make integration seamless. By "seamless", I mean: - No external configuration required (but not precluded) - Minimal configuration options - Subreports are discovered automatically - Parameters are passed automatically - No coding required (99% of the time) - One form, one bean, one report Here is what I did: <form name="report" method="post" action="reportBean.run"> <!-- Location of reports and subreports. --> <input type="hidden" name="REPORT_PATH" value="reports/Names" /> <input type="hidden" name="REPORT_FILE" value="List" /> <!-- Optional; false is default. --> <input type="hidden" name="REPORT_EMBED" value="false" /> <!-- Parameters passed directly to the report. --> Name: <input type="text" name="report_Name" value="" /><br /> Date: <input type="text" name="report_Date" value="" /><br /> <input type="submit" name="View" value="pdf" /> <input type="submit" name="Export" value="xls" /> </form> By identifying the names of the input parameters with a common prefix (e.g., report_), the framework can automatically pass them to the report. By specifying the path to the report directory (always relative to WEB-INF, by default) and the name of the report, it also allows the framework to tell the master report where to find its subreports. In practice, I wrote 20 vastly different reports (charts; trend lines; master reports with many subreports; and reports with list, date, and numeric parameters) and never wrote a single line of code, nor touched any configuration files or properties files. Unfortunately the company that contracted me to develop the integration does not want the source code released (at this time). It also greatly enhanced productivity because any change to the report, or report parameters, did not require restarting the server. Changing the report required resubmitting the form. Changing the form required reloading the page. Dave |