Creating a report source object

Creating a Java Reporting Component report source only requires you to have the location of the report you wish to view or export. The report location can be specified using a file system path, UNC address, or URL. For more information on the Java Reporting Component report source and specifying paths, see Java Reporting Component. Also, for the Java Reporting Component to correctly retrieve data for a report, the report's data sources must be correctly specified through JNDI. For more information on data source configuration, see Configuring data sources.

To create a report source object
  1. Ensure that you have imported the JPEReportSourceFactory class and the IReportSource and IReportSourceFactory2 interfaces.

    <%@ page import="com.crystaldecisions.reports.reportengineinterface.JPEReportSourceFactory,

    com.crystaldecisions.sdk.occa.report.reportsource.IReportSourceFactory2,

    com.crystaldecisions.reports.reportengineinterface.IReportSource"

    %>

  2. Create a new JPEReportSourceFactory object.

    IReportSourceFactory2 rptSrcFactory = new JPEReportSourceFactory();

  3. Call the IReportSourceFactory2 object's createReportSource method, passing it the path to the desired report and the current locale settings.

    The IReportSource object can now be used by the viewer or export control.

    String report = "/reports/sample.rpt";

    IReportSource reportSource = (IReportSource) rptSrcFactory.createReportSource(report, request.getLocale());



Crystal Decisions
http://www.crystaldecisions.com/
Support services
http://support.crystaldecisions.com/