6. Adding "Save As" functionality
Exercise Objectives
The objective of this session is to add a "Save As" feature to the simple browsing
application.
Exercise Description
Now that your application includes a browser to locate and open presentations,
your users may want to modify a saved presentation
and to save it as a different presentation. You can add this functionality
to the simple application easily by using predefined custom BI Beans JSP tags.
Exercise Tasks
Create the "Save Confirmation" Page
If a user attempts to replace a presentation with another presentation that has the same name,
a confirmation page should be displayed so that the user can confirm the action.
Now, we will create this confirmation page.
To create a new JSP
- Based on the directions in the Creating
a Simple BI JSP Application exercise, create a new empty page for your
JSP application. Use
saveConfirmationJSP.jsp
as the filename.
- Add a BIThinSession JSP tag with id
app
and
the same connection configuration file /Project1BIConfig1.xml
.
To open the SaveConfirmation tag wizard
- In the Code Editor, place the cursor on the line below the
<%--
Insert your Business Intelligence tags here --%>
comment.
- In the Component Palette pane, under Business Intelligence Tags,
choose the SaveConfirmation icon.
To use the SaveConfirmation tag wizard
In the SaveConfirmation wizard, you define the attribute
values for the SaveConfirmation tag.
- In the id box, enter
saveConfirmation.
- Do not enter values in the remaining attributes.
- Choose Finish to create the tag.
To review the generated SaveConfirmation tag code
In the Code Editor, you can see the code that was generated for the SaveConfirmation tag.
The following code identifies the folder (within the Catalog) in which to save the presentation:
<orabi:SaveConfirmation id="saveConfirmation" />
The following code displays the SaveConfirmation dialog:
<orabi:Render targetId="saveConfirmation" parentForm="BIForm" />
To create the Apply button for "Save Confirmation"
- 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.
- In the Component Palette pane, under Business Intelligence Tags,
choose the ApplyButton icon.
- In the ApplyButton wizard, you can define the attribute values for the ApplyButton
tag.
- Accept the default for the id (saveConfirmationJSP_ApplyButton1).
- In the dialogId box, select saveConfirmation.
- Do not enter values in the remaining attributes.
- Choose Finish to create the tag.
In the Code Editor, you can see the code that was generated for the ApplyButton tag.
The following code creates an apply button for saving:
<orabi:ApplyButton id="saveConfirmationJSP_ApplyButton1" dialogId="saveConfirmation"
/>
The following code displays the apply button:
<orabi:Render targetId="saveConfirmationJSP_ApplyButton1" parentForm="BIForm"
/>
To create the Cancel button for "Save Confirmation"
- 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.
- In the Component Palette pane, under Business Intelligence Tags,
choose the CancelButton icon.
- In the CancelButton wizard, you can define the attribute values for the
CancelButton tag.
- Accept the default for the id (saveConfirmationJSP_CancelButton1).
- In the dialogId box, select saveConfirmation.
- Do not enter values in the remaining attributes.
- Choose Finish to create the tag.
In the Code Editor, you can see the code that was generated for the cancel button.
The following code creates a cancel button:
<orabi:CancelButton id="saveConfirmationJSP_CancelButton1" dialogId="saveConfirmation"
/>
The following code displays the cancel button:
<orabi:Render targetId="saveConfirmationJSP_CancelButton1" parentForm="BIForm"
/>
From the File menu, choose Save All to save the JSP application.
Create the "Save As" Page
This "Save As" page allows the user to locate the folder
that will store the presentation and to define a name for the presentation
To create a new JSP
- Based on the directions in the Creating
a Simple BI JSP Application exercise, create a new empty page for your
JSP application. Use
saveAsJSP.jsp
as the filename.
- Add a BIThinSession JSP tag with id
app
and
the same connection configuration file /Project1BIConfig1.xml
.
To create an explorer for users to locate the folder for saving
a presentation
- In the Code Editor, place the cursor on the line below the
<%--
Insert your Business Intelligence tags here --%>
comment.
- In the Component Palette pane, under Business Intelligence Tags,
choose the ExplorerTree icon.
- In the ExplorerTree wizard, you can define the attribute values for the
ExplorerTree tag.
- In the id box, enter
saveTree
.
- Do not enter values in the remaining attributes.
- Choose Finish to create the tag.
To review the generated ExplorerTree tag code
In the Code Editor, you can see the code that was generated for the ExplorerTree tag.
The following code creates a Catalog browser for saving presentations:
<orabi:ExplorerTree id="saveTree" />
The following code displays the Catalog browser that allows saving:
<orabi:Render targetId="saveTree" parentForm="BIForm" />
To open the SaveAs tag wizard
- In the Code Editor, position the cursor on the line above the
<%--
The InsertHiddenFields tag adds state fields to the parent form tag --%>
comment.
- In the Component Palette pane, under Business Intelligence Tags,
choose the SaveAs icon.
To use the SaveAs tag wizard
In the SaveAs wizard, you can define the attribute values for the SaveAs tag.
- In the id box, enter
saveAs.
- In the explorerTreeId box, select saveTree. This attribute
identifies the explorer tree that is to locate the folder in which to save
the presentation.
- In the saveConfirmationPage box, select saveConfimationJSP.jsp.
- In the saveConfirmationId box, select saveConfirmation.
- Do not enter values in the remaining attributes.
- Choose Finish to create the tag.
To review the generated SaveAs tag code
In the Code Editor, you can see the code that was generated for the SaveAs tag.
The following code identifies the folder (within the Catalog) in which to save
the presentation:
<orabi:SaveAs id="saveAs" explorerTreeId="saveTree" saveConfirmationPage="saveConfirmationJSP.jsp"
saveConfirmationId="saveConfirmation" />
The following code displays the SaveAs dialog:
<orabi:Render targetId="saveAs" parentForm="BIForm" />
To create the Apply button for "Save As"
- In the Code Editor, position the cursor on the line above the
<%--
The InsertHiddenFields tag adds state fields to the parent form tag --%>
comment.
- In the Component Palette pane, under Business Intelligence Tags,
choose the ApplyButton icon.
- In the ApplyButton wizard, you can define the attribute values for the ApplyButton
tag.
- Accept the default for the id (saveAsJSP_ApplyButton1).
- In the dialogId box, select saveAs.
- Do not enter values in the remaining attributes.
- Choose Finish to create the tag.
In the Code Editor, you can see the code that was generated for the apply button for saving.
The following code creates the apply button for saving:
<orabi:ApplyButton id="saveAsJSP_ApplyButton1" dialogId="saveAs" />
The following code displays the apply button:
<orabi:Render targetId="saveAsJSP_ApplyButton1" parentForm="BIForm"
/>
To create the Cancel button for "Save As"
- In the Code Editor, position the cursor before the
<%-- The
InsertHiddenFields tag adds state fields to the parent form tag --%>
comment. Press Enter to move the comment to the next line.
- In the Component Palette pane, under Business Intelligence Tags,
choose the CancelButton icon.
- In the CancelButton wizard, you can define the attribute values for the
CancelButton tag.
- Accept the default for the id (saveAsJSP_CancelButton1).
- In the dialogId box, select saveAs.
- Do not enter values in the remaining attributes.
- Choose Finish to create the tag.
In the Code Editor, you can see the code that was generated for the cancel button:
<orabi:CancelButton id="saveAsJSP_CancelButton1" dialogId="saveAs"
/>
The following code displays the cancel button:
<orabi:Render targetId="saveAsJSP_CancelButton1" parentForm="BIForm"
/>
From the File menu, choose Save All to save the JSP application.
Add "Save" and "Save As" buttons to the presentation viewer page
Finally, add 'Save" and "Save As" buttons to the viewer page
so that users can save a presentation.
To open the SaveButton tag wizard
- In the System-Navigator pane, right-click viewerJSP.jsp
and choose Code Editor from the popup menu to open the Code
Editor.
- 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.
- In the Component Palette pane, under Business Intelligence Tags,
choose the SaveButton icon (locate by using the scroll arrow
on the right, if necessary).
To use the SaveButton tag wizard
In the SaveButton wizard, you define the attribute values for the SaveButton
tag.
- In the id box, enter
save.
- In the presentation id box, enter
viewer.
- In the saveConfirmationPage box, select saveConfimationJSP.jsp.
- In the saveConfirmationId box, select saveConfirmation.
- Do not enter values in the remaining attributes.
- Choose Finish to create the tag.
To review the generated SaveButton tag code
In the Code Editor, you can see the code that was generated. The following
code creates the save tool:
<orabi:SaveButton id="save" presentationId="viewer" saveConfirmationPage="saveConfirmationJSP.jsp"
saveConfirmationId="saveConfirmation" />
The following code displays the save button:
<orabi:Render targetId="save" parentForm="BIForm" />
To open the DialogLink tag wizard for the Save As button
- In the Code Editor, position the cursor on the line above the
<%--
The InsertHiddenFields tag adds state fields to the parent form tag --%>
comment.
- In the Component Palette pane, under Business Intelligence Tags,
choose the DialogLink icon.
To use the DialogLink tag wizard for the Save As button
In the DialogLink wizard, you can define the attribute values for the DialogLink
tag.
- In the id box, enter
saveAsDialogLink.
- In the presentationId box, select viewer.
- In the targetPage box, select saveAsJSP.jsp. This attribute
identifies the "Save As" page to use for saving the presentation.
- In the targetToolId box, select saveAs. This attribute
identifies the id of the "Save As" tool to use.
- In the text box, enter
Save As.
- Do not enter values in the remaining attributes.
- Choose Finish to create the tag.
To review the generated DialogLink tag code for the Save As button
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 SaveAs page:
<orabi:DialogLink id="saveAsDialogLink" presentationId="viewer" targetPage="saveAsJSP.jsp"
targetToolId="saveAs" text="Save As" />
The following code displays the linking button:
<orabi:Render targetId="saveAsDialogLink" parentForm="BIForm" />
From the File menu, choose Save All to save the JSP application.
Run the application
You have created a simple application that allow users to open and modify a
previously saved presentation and then save it as a different presentation.
- In the System-Navigator pane, right-click detailJSP.jsp
and choose Run detailJSP.jsp from the popup menu.
- On the explorer details page, select Sales Analysis Crosstab.
- The crosstab appears in the presentation viewer page. Modify some crosstab
parameters (for example, drill down on Japan to see sales by city) and then
choose Save.
- The new crosstab design is saved. Use the Back button on
the browser to go back to the explorer details page. Select Sales
Analysis Crosstab.
- The saved crosstab is displayed.
- On the crosstab view page, choose Save As.
- On the "Save As" page, in the Name box, enter
New Crosstab.
- In the Description box, enter
A new crosstab
and choose Apply.
- Use the Back button on the browser to go back to the explorer
details page and use the Refresh button on the browser to
refresh the page.
- The explorer details page confirms that New Crosstab has
been saved in the root folder.
- Return to JDeveloper. From the Run menu, choose Terminate
then Embedded OC4J Server to stop the application.
Exercise Summary
You have added the "Save As" feature to a simple application easily without
writing a single line of code.
5. Building a BI Beans Catalog
Browser | Overview
| 7. Adding "Export" Functionality