Using the Crystal Tag Libraries

Now that you understand how the report viewer works, its beneficial to understand some of the ways that it can be used in a more productive manner. Java tag libraries are a great way to accomplish this. A tag library (taglib) is an HTML-like tag that can be embedded inside a JSP page; it has some compiled code logic behind it that knows how to render itself to HTML. The beauty of a tag library is that you don need to clog up your JSP page with a bunch of code; you simply need to insert the tag. When Business Objects created the HTML report viewer, they were wise enough to create some Java tag libraries alongside it. This is not to say you could not create your own tag libraries to suit your own needs, but the ones provided with the product will probably meet most requirements.

Refer to the Application Server Configuration section in this chapter for steps to configure the Crystal tag libraries. After youve finished the setup, you can start adding the tags to your page. The first step in using the tag is to add the taglib directive to the top of your JSP page. This directive looks like this:






<%@ taglib uri="/crystal-tags-reportviewer.tld" prefix="crviewer" %>


This indicates to the JSP page that any time it finds a tag prefixed with crviewer, it should look in the crystal-tags-reportviewer.tlb file to find out how to work with that tag.

There are two tags that must be added to the JSP page: viewer and report. Listing 28.2 shows a simple page using the viewer and report tags.

Listing 28.2. Using the Tag Libraries

<%@ taglib uri="/crystal-tags-reportviewer.tld" prefix="crviewer" %>



 




The viewerName and reportSourceType attributes of the viewer tag are required. The viewerName can be set to blank unless there are multiple viewer tags on the same page, in which case youll need to name them uniquely. There is only one report source type supported in the Java Reporting Component, which is "reportingComponent." Inside the viewer tag, youll see a report tag. For the reportName attribute, pass in the name of the report you want to display. The output of this page would be exactly the same as the output of the previous code example using inline Java code. The advantage of this page is that it is cleaner and simpler. To customize the viewer, rather than writing code, simply add attributes to the viewer tag. For example, adding the following attribute to the viewer tag hides the group tree:






displayGroupTree="false"


There are many other attributes supported. Consult the documentation for a full list but the general rule is that most methods on the CrystalReportViewer object have a corresponding tag library attribute.


Part I. Crystal Reports Design

Creating and Designing Basic Reports

Selecting and Grouping Data

Filtering, Sorting, and Summarizing Data

Understanding and Implementing Formulas

Implementing Parameters for Dynamic Reporting

Part II. Formatting Crystal Reports

Fundamentals of Report Formatting

Working with Report Sections

Visualizing Your Data with Charts and Maps

Custom Formatting Techniques

Part III. Advanced Crystal Reports Design

Using Cross-Tabs for Summarized Reporting

Using Record Selections and Alerts for Interactive Reporting

Using Subreports and Multi-Pass Reporting

Using Formulas and Custom Functions

Designing Effective Report Templates

Additional Data Sources for Crystal Reports

Multidimensional Reporting Against OLAP Data with Crystal Reports

Part IV. Enterprise Report Design Analytic, Web-based, and Excel Report Design

Introduction to Crystal Repository

Crystal Reports Semantic Layer Business Views

Creating Crystal Analysis Reports

Advanced Crystal Analysis Report Design

Ad-Hoc Application and Excel Plug-in for Ad-Hoc and Analytic Reporting

Part V. Web Report Distribution Using Crystal Enterprise

Introduction to Crystal Enterprise

Using Crystal Enterprise with Web Desktop

Crystal Enterprise Architecture

Planning Considerations When Deploying Crystal Enterprise

Deploying Crystal Enterprise in a Complex Network Environment

Administering and Configuring Crystal Enterprise

Part VI. Customized Report Distribution Using Crystal Reports Components

Java Reporting Components

Crystal Reports .NET Components

COM Reporting Components

Part VII. Customized Report Distribution Using Crystal Enterprise Embedded Edition

Introduction to Crystal Enterprise Embedded Edition

Crystal Enterprise Viewing Reports

Crystal Enterprise Embedded Report Modification and Creation

Part VIII. Customized Report Distribution Using Crystal Enterprise Professional

Introduction to the Crystal Enterprise Professional Object Model

Creating Enterprise Reports Applications with Crystal Enterprise Part I

Creating Enterprise Reporting Applications with Crystal Enterprise Part II

Appendix A. Using Sql Queries In Crystal Reports

Creating Enterprise Reporting Applications with Crystal Enterprise Part II



Special Edition Using Crystal Reports 10
Special Edition Using Crystal Reports 10
ISBN: 0789731134
EAN: 2147483647
Year: 2003
Pages: 341

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net