I. Overview
Web report is allowed to contain parameters. How can we pass parameter values to a web report when we access the report with a browser?
In general, we add parameters at the end of the path to the web report being accessed, for example: http://localhost:8075/webroot/decision/view/report?viewlet=com.fr.demo.URLParameterDemo&Region=North China. Where there are a few dozen parameters, parameter values will be passed to the program in forms of lists, arrays and so on.
The program gets the parameter value in the request, then assigns it to the parameter in the report, and finally displays the corresponding report.
We will take Template_Parameter.cpt for example. Read the template, convert it to a web report containing parameters, and pass these parameters when accessing the report.
II. Sample
Click the link to view the list of executable codes: https://github.com/finereport-overseas/example/blob/release/10.0/src/main/java/com/fr/demo/URLParameterDemo.java
III. Preview
Save URLParameterDemo.class generated from compiling to %FR_HOME%\webroot\WEB-INF\classes\com\fr\demo.
Trigger the Report Server, access web reports in a browser and pass parameter values to the following path: http://localhost:8075/webroot/decision/view/report?viewlet=com.fr.demo.URLParameterDemo&Region=North China.
Then you can see the effect below: