Lesson 3: Running a report with parameters

You have been asked to run OrderListbyDate_Parameter.cls from your JSP application and this report requires parameters to run. You don't want JReport Server to display the default JSP page to enter the parameter value so you need to write a JSP page to request the parameter values, and then run the report with the specified values.

In this lesson you will also need to use Page Report Studio API to run the report without using the tag library.

This lesson comes with an HTML file that requests the parameters and a JSP file that runs and displays OrderListbyDate_Parameter.cls in Page Report Studio in a new web browser window.

  1. Copy the runWithParameter.html file in <install_root>\help\samples\JSPSamples\JinfonetGourmetJavaDemo to <install_root>\public_html\jag.
  2. Open runWithParameter.html in your favorite editor and review the code if desired.
  3. Copy runWithParameter.jsp in <install_root>\help\samples\JSPSamples\JinfonetGourmetJavaDemo to <install_root>\public_html\jag.
  4. Open this file in an editor and review the code if desired.
  5. Browse http://localhost:8888/jag/runWithParameter.html.
  6. Select the start date and end date and click Run report. You may see the result generated with the specified parameter values, for example:

Lesson 3 summary

In this lesson you have learned how to use JSP and Page Report Studio API to run a report with parameter collected through the user interface. Often this information is known by your application so there is no need to prompt the user for the information, it can be provided directly from the application calling the report.