Crystal Reports XI Official Guide

For years, Microsoft ASP developers debated best practices for organizing their web applications and managing interactions between the front- and back-ends. The .NET framework answered many of these questions, providing a neat methodology, system libraries, and IDE integration capability for quickly and easily wiring together stateless components into interactive web applications. In certain respects, what .NET is to ASP, JavaServer Faces (JSF) is to JSP. The similarities are so striking, in fact, that you might surmise that Redmond helped with the design. Its goal is to make rapid, consistent, and visual application development possible through a set of libraries and strict methodologies that integrated development environments (IDEs) can understand.

JSF is a follow-on to the ever-popular Apache STRUTS application development framework. Both provide an architectural design based on the Model View Controller (MVC) JSP Model 2 pattern that specifies that end-user requests are managed by a servlet that controls the flow, components are used to access and manipulate the data, and JSP is used to render content to the browser. The JSP Model 2 pattern can be difficult to understand. A simplified diagram is shown in Figure 31.8. Please Google this topic to learn more.

Figure 31.8. The JSP Model 2 MVC design pattern.

Although STRUTS had a large following, it was not a standard managed by the Java Community Process (JCP). Some critics note that the design changed frequently and tool vendors were late and inconsistent in their support. JSF, on the other hand, is a JCP standard that was designed for use inside of tools from the very beginning. As such, it is a stable specification supported by all Java tool vendors.

If JSF thrives, it is likely that you will see much more in this area from vendors such as Business Objects. In XI, Business Objects offered a taste of JSF with the Crystal Reports viewer control.

Note

The samples provided in Chapter 30 do not follow the JSF design methodology. Rather, they loosely follow a Model 1 architecture shown in Figure 31.9 where most computation and processing is done in Java classes and rendered through JSP scriptlets.

Figure 31.9. The JSP Model 1 design pattern.

Note

Frankly, JSF components require more effort to write, and building JSF applications requires thinking inside the JSF box, which some find cramped and uncomfortable. JSF will feel like old shoes for an MVC veteranothers might struggle at first. For large development projects involving many developers, releases, and maintenance requests, using a development framework such as STRUTS or JSF is highly recommended. For smaller endeavors, there's no shame in using simpler approaches like JSP Model 1.

JSF Component Overview

With BusinessObjects Enterprise XI, six JSF components are provided. Together, they permit logging into BusinessObjects Enterprise, changing passwords, displaying and browsing repository folders, rendering folder breadcrumbs, and viewing a Crystal Report.

Product documentation fully describes configuring and using the JSF components. The technical support team has also put together some wonderful viewlets documenting a sample development project in IBM Rational IDE that they have kindly posted at www.usingcrystal.com.

After these controls are registered with the IDE, they can be easily added to web projects. Figure 31.10 shows adding Enterprise Faces Components, Report Viewers Faces Components, and the Java Reporting Component (JRC) to a web project. Larger implementations prefer using the BusinessObjects Enterprise Page Server as a report source, eliminating the need for the JRC.

Figure 31.10. Adding JSF controls to a project.

After the components are added to your project, you can drag and drop them onto your pages, set their properties, and wire them together using listeners in the code-behind pages. Figure 31.11 shows a folder-browsing and report-viewing application under construction.

Figure 31.11. JSF folder-viewing application.

The six JSF components are as follows

  • logon Renders an HTML BusinessObjects Enterprise logon form

  • changePassword Renders an HTML BusinessObjects Enterprise change password form.

  • itemsGrid Renders (along with one or more itemsColumn tags) an HTML table, or grid, that displays the items from an EnterpriseItem or EnterpriseItems bean

  • itemsColumn Renders column within itemsGrid to display property of items from an EnterpriseItem or EnterpriseItems bean

  • path Renders hyperlink breadcrumb trail

  • reportPageViewer Renders Crystal Reports DHTML viewer

For more complete instructions for setting up and working with JSF components, please consult the product documentation and check out www.usingcrystal.com.

Категории