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.
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.
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