7. Adding "Export" functionality

Exercise Objectives

The objective of this session is to add an "Export" feature to the simple browsing application.

Exercise Description

Users may want to export the content of a presentation to flat files or CSV files, which can then be imported into spreadsheet applications such as Microsoft Excel. You can add this functionality to the simple application easily by using predefined, custom BI Beans JSP tags.

Exercise Tasks

Create the "Export" Page

The "Export" page contains an export dialog box that allows users to define export options.

To create a new JSP

  1. Based on the directions in the Creating a Simple BI JSP Application exercise, create a new empty page for your JSP application. Use exportJSP.jsp as the filename.
  2. Add a BIThinSession JSP tag with id app and the same connection configuration file /Project1BIConfig1.xml.
To open the ExportOptions tag wizard
  1. In the Code Editor, position the cursor on the line below the <%-- Insert your Business Intelligence tags here --%> comment.
  2. In the Component Palette pane, under Business Intelligence Tags, choose the ExportOptions icon.
To use the ExportOptions tag wizard

In the ExportOptions wizard, you can define the attribute values for the ExportOptions tag.

  1. In the id box, enter export.
  2. Do not enter values in the remaining attributes.
  3. Choose Finish to create the tag.
To review the generated ExportOptions tag code

In the Code Editor, you can see the code that was generated for the ExportOptions tag. The following code creates the export tag:

<orabi:ExportOptions id="export" />

The following code displays the export dialog box:

<orabi:Render targetId="export" parentForm="BIForm" />

To create the Apply button for "Export"

  1. In the Code Editor, position the cursor above the line that contains the <%-- The InsertHiddenFields tag adds state fields to the parent form tag --%> comment.
  2. In the Component Palette pane, under Business Intelligence Tags, choose the ApplyButton icon.
  3. In the ApplyButton wizard, you can define the attribute values for the ApplyButton tag.
  4. Accept the default for the id (exportJSP_ApplyButton1).
  5. In the dialogId box, select export.
  6. Do not enter values in the remaining attributes.
  7. Choose Finish to create the tag.

In the Code Editor, you can see the code that was generated for the ApplyButton. The following code creates an apply button for exporting:

<orabi:ApplyButton id="exportJSP_ApplyButton1" dialogId="export" />

The following code displays the apply button:

<orabi:Render targetId="exportJSP_ApplyButton1" parentForm="BIForm" />

To create the Cancel button for "Export"

  1. In the Code Editor, position the cursor above the line that contains the <%-- The InsertHiddenFields tag adds state fields to the parent form tag --%> comment.
  2. In the Component Palette pane, under Business Intelligence Tags, choose the CancelButton icon.
  3. In the CancelButton wizard, you can define the attribute values for the CancelButton tag.
  4. Accept the default for the id (exportJSP_CancelButton1).
  5. In the dialogId box, select export.
  6. Do not enter values in the remaining attributes.
  7. Choose Finish to create the tag.

In the Code Editor, you can see the code that was generated for the CancelButton tag. The following code creates an apply button for canceling:

<orabi:CancelButton id="exportJSP_CancelButton1" dialogId="export" />

The following code displays the cancel button:

<orabi:Render targetId="exportJSP_CancelButton1" parentForm="BIForm" />

From the File menu, choose Save All to save the JSP application.


Add "Export" button to the presentation viewer page

Finally, you will add an "Export" button to the viewer page so that users can access the "Export" page to export the presentation.

To open the DialogLink tag wizard

  1. In the System-Navigator pane, right-click viewerJSP.jsp and choose Code Editor from the popup menu to open the Code Editor.
  2. In the Code Editor, position the cursor above the line that contains the <%-- The InsertHiddenFields tag adds state fields to the parent form tag --%> comment.
  3. In the Component Palette pane, under Business Intelligence Tags, choose the DialogLink icon.
To use the DialogLink tag wizard

In the DialogLink wizard, you can define the attribute values for the DialogLink tag.

  1. In the id box, enter exportDialogLink.
  2. In the presentationId box, select viewer.
  3. In the targetPage box, select exportJSP.jsp.
  4. In the targetToolId box, select export.
  5. In the text box, enter Export.
  6. Do not enter values in the remaining attributes.
  7. Choose Finish to create the tag.
To review the generated DialogLink tag code

In the Code Editor, you can see the code that was generated for the DialogLink tag. The following code creates a button for linking to the "Export" page:

<orabi:DialogLink id="exportDialogLink" presentationId="viewer" targetToolId="export" targetPage="exportJSP.jsp" text="Export" />

The following code displays the linking button:

<orabi:Render targetId="exportDialogLink" parentForm="BIForm" />

From the File menu, choose Save All to save the JSP application.


Run the application

You have created a simple application that allows users to export the contents of an open presentation.

  1. In the System-Navigator pane, right-click viewerJSP.jsp and choose Run viewerJSP.jsp from the popup menu.
  2. On the crosstab view page, choose Export.
  3. On the "Export" page, select the desired export options and choose Export.
  4. After an export of the crosstab data values is generated, return to JDeveloper and, from the Run menu, choose Terminate then Embedded OC4J Server to stop the application.

Exercise Summary

You have added the "Export" feature to a simple application easily without writing a single line of code.

6. Adding "Save" Functionality | Overview | 8. Adding "Print" Functionality