Flylib.com

Books Software

 
 
 

Things You Can Do with the Java Viewer


Things You Can Do with the Java Viewer

Some of the features in the Java Viewer that make your job easier include the capabilities to search the text of the report and to depict data contained in the report as a grid. In addition, the user of your JSP application is able to drill down from general data contained in the report to detailed reporting data by simply pointing and clicking the mouse.

Reports served up by the Crystal Enterprise Server and the Report Application Server also enable your JSP application to display a map as part of the Crystal report and enable the user to drill down to display a map in more or less detail than was originally displayed in the Crystal report.

Another useful feature is the capability for you to pick and choose elements of a Crystal report to display on the screen. Instead of displaying the entire report, your JSP application can show in the web page only pieces of the report that are relevant to your application. Let s say that you want to use in your application a graph based on data from a Crystal report. By using report parts , you can simply use the graph and nothing else from the Crystal report. The Report Part Viewer allows you to display reports showing only limited objects on the report. It allow allows Report Part Navigation, which allows a limited set of objects to act as hyperlinks to other limited object in other reports.

It is very common for users of your JSP application to need a report in a format that they can download and manipulate themselves . This usually requires you to write code that translates the report into the desired format. The Java Viewer classes already include this code for Word, Excel, and other popular file formats.



Let s Get Started

Now that you have a good idea of what you can do with the Java Viewer, it s time to learn how to embed a Crystal report in your JSP application. You ll need to have a Java Application Server either installed and configured on your development computer or available on a network, assuming that your computer is connected to a network. If you don t have a Java Application Server running, then you cannot use JSP applications developed using the Java Viewer classes. If you don t have a Java Application Server, then you can download one from java.sun.com.

You also need to install the Java Reporting Component included with Crystal Reports 10 Developer or Advanced Developer Edition (Crystal Reports 10 Standard and Professional Editions don t include the Java Reporting Component). The Java Viewer classes are included in the JAR file included with these Crystal Reports 10 editions. When you initially insert the Crystal Reports 10 CD, you ll find a link on the introductory screen that will install the Java Reporting Component. You can also find various installation options within the Crystal_ Report_Java_Components folder on the CD.

Once you have the Java Application Server and the Crystal Reports 10 Java Reporting Component installed, you need to run the Java Application Server. You don t need to run the Java Reporting Component.

Setting Up the Java Viewer

The Java Viewer classes are located in webreporting- core .jar. You ll find this file located at:

  • Windows C:\Program Files\Common Files\Crystal Decisions\2.5\java\lib

  • Unix crystal-root /java/lib ( crystal-root is the directory where the Java Reporting Component is installed)

Copy the JAR file and the CrystalReportEngine-Config.xml file to your JSP application WEB-INF/classes folder. The CrystalReportEngine-Config.xml file contains details of the Java Reporting Component configuration. This is required only by the Java Reporting Component, not by the other report engines.

Move all JAR files from the java folder to the lib directory of the application s WEB-INF folder. This ensures that all required libraries required by the Java Reporting Component and viewers are available to the application. Copy the crystalreportviewers10 directory to the root directory of your JSP application. Specify the location of the crystalreportviewers10 directory in the web.xml file as the crystal_image_uri context parameter. Here s an example:

<!-- Context Param -->

<context-param>
<param-name>crystal_image_uri</param-name>
<param-value>/crystalreportviewers</param-value>
</context-param>
<!-- Context Param End -->

The Java Reporting Component can connect to the data source used by the Crystal report. The data source is typically a database managed by a Database Management System (DBMS) that is accessible using JDBC or JNDI data source.

However, a Crystal report might be designed using a different connection method such as ODBC or OLE-DB. In such cases, the Java Reporting Component automatically attempts to map this connection to the JNDI data source, which must be the server name specified in the Crystal report. This is only a requirement of the Java Reporting Component. You don t need to do this for the other reporting engines.

Configuring the Java Reporting Component

The Java Reporting Component needs to know where to locate the report source for the Crystal report that you want to use with your JSP application. The value of the reportlocation tag is the root directory used by the Java Reporting Component to locate the report source. Typically, each report source will have its own directory beneath the root directory.

You specify the location as the value to the reportlocation tag in the CrystalReportEngine- config.xml file. You ll find the CrystalReportEngine-config.xml file in the WEB-INF directory. The value of the reportlocation tag must be a path specified relative to the Java Reporting Component (the initial release of the Java Reporting Component does not accept absolute paths). The default location of the Java Reporting Component is the WEB-INF/lib directory.

So, you might specify a relative path to the reportlocation tag similar to:

  • Relative URL to the Java Reporting Component location

    (Remember that the Java Reporting Component JAR file is in /WEB-INF/lib directory.)

    ../reports/accounting