Oracle Business Intelligence Beans Sample

BI Beans within Struts

Overview

The BI Beans Struts sample demonstrates how BI Beans can be used with the Struts framework to build an web application that is functional equivalent to the generated BI UIX Application. This sample assumes you're familiar with the basics of Struts framework. If not, you may want to visit the Struts site (http://jakarta.apache.org/struts/) to learn more about this technology. The sample allows end users to open a Presentation from BI Catalog, perform data analysis with the Presentation, such as drill, pivot, etc. The end users can print, export and save the report as well.

Setup Requirements

Open the workspace struts\struts.jws under the samples directory within JDeveloper. All the necessary files for this sample can be found in the struts.jpr project under the struts.jws workspace.

Modify the BIDesigner design settings in the project to your BI Beans environment (i.e. connection to OLAP and BI Beans Catalog) (similar to "Update the sample project settings" under Installing and Configuring the Samples).

MVC2 model

In this sample, MVC2 model is adopted to build the web application. JSP pages are used to build the view layer. Struts framework and a few action classes act as the controller and BI HTML beans act as the model. Both UIX JSP tags and BI JSP render tags are used to build the view layer. BI JSP render tag is used to render BI HTML beans and UIX JSP tags are used to render pageLayout, Button etc.

State management

In BI JSP/UIX tags and BI servlet, BI HTML bean state information is saved as hidden form values, thus contained in the URLs resulted from submitting of the forms. Since the state information is contained in the URLs, the end user can bookmark a particular URL if he/she sees a page that is of interest to him/her. Since most browsers limit the URLs to certain length, putting state information in the URLs has the potential problem of overflowing the URLs. BI Beans Struts sample manages the state information of BI HTML beans using a technique called "transient state management". In transient state management, state information is saved in a session level object instead of using hidden form values. Since state information is saved using a server-side object, the URL overflowing problem is avoided. The BIStateRequestProcessor class overrides the RequestProcessor class provided by the Struts framework to provide BI Beans state management. The processPreprocess method is invoked for each HTTP request before its associated action class is invoked. This method is overridden so that we have a hook to set the state of the BI HTML beans in the application. When setting the state, a unique state key is retrieved from the incoming URL and used to retrieve a Hashtable object that stores state strings for the various BI HTML beans. The processActionForward method is invoked for each HTTP request after its associated action class has been invoked. This method is overridden to create a new set of state strings and store it in the BIStateManager class. For details on transient state management, please consult Chapter 4 of UIX developer's guild.

A brief description of the Java classes

The following section provides a walkthrough and explanations of the Java classes in the sample.

For each of the JSP pages in the sample application, there is an action class that creates and initializes the BI HTML beans that are used in the JSP pages. The StartAction class initializes the ExplorerDetail bean that is used in the open.jsp. The InitViewPageAction class creates and initializes the view object according the information contained in the SELECT_OBJECT_EVENT event fired by the ExplorerDetail control. The other task performed by the InitViewPageAction is that it initializes the ViewToolbar object and hooks it up with the View. The InitExportOptionAction is responsible for creating and initializeing the ExportOptions dialog used in the exportOptions.jps. The InitPrintOptionAction class creates and initializes the the PrintOptions dialog used in printOptions.jsp. The InitPrinterFriendlyAction is responsible for initializing the PrinterFirendlyView control used in printerFriendlyView.jsp. The InitSaveAsAction classes initializes the SaveAs dialog used in the saveas.jsp. The ViewAction class handles the handles the build-in view events such as DRILL_EVENT, ROTATE_EVENT etc. It simply finds the targeted BI HTML bean and let it handles it. The ViewTypeChangeAction handles the VIEW_TYPE_CHANGED_EVENT fired by the ViewToolbar in the analyze.jsp The ViewTypeChangeAction class handles the VIEW_TYPE_CHANGED_EVENT event fired by the ViewToolBar. The ViewAction class the build-in events that are handled directly by the view objects, such as DRILL_EVENT, ROTATE_EVENT etc.

How To Run

To run the BI Beans Struts example within JDeveloper, find the struts-config.xml node in the project, expand the node if it is not already expanded, right-click on the "/start" child node and select Run /start menu pick.

oracle logo  
Copyright © 2003 Oracle. All Rights Reserved.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.