The BIMultiplePageServlet demonstrates a multiple page application. The current page is stored as application state. The application state can be placed onto the URLs/Forms that an application generates, so that the application can re-establish its state from a request's URL.
After connecting to the OLAP and the BI Beans Catalog, the first page (Open Report) displays the contents of the BI Beans Catalog. The ExplorerTree thin bean displays the list of folders in the BI Beans Catalog. The ExplorerTree thin bean is linked with the ExplorerDetail thin bean. On selecting a folder in the ExplorerTree thin bean, the views contained in the folder are displayed in the ExplorerDetail thin bean.
The views can be opened using the ExplorerDetail thin bean. The views are displayed on the second page (Analyze) of the application.
If you have not already done so, you must perform several installation
and configuration tasks, then open the workspace servlet\Servlet.jws
under the samples
directory within JDeveloper. All the necessary
files for this sample can be found in the multiple_page_application.jpr
project under the Servlet.jws
workspace.
The following section provides a walkthrough and explanations of the code fragments: The processRequest method is called by the base class after a successful user login. The first step of the application is to initialize the thin beans on the current page. The following code initializes the thin beans on the Open Report page.
ExplorerDetail explorerDetail = new ExplorerDetail ( );
explorerDetail.setThinBeanName ( EXPLORER_DETAIL_NAME );
explorerDetail.setBIContext ( biHttpSession.getMetadataManager ( ).getMDRoot
( ) );
explorerDetail.addExplorerListener ( new OpenDeleteListener ( biHttpSession
) );
handler.registerThinBean ( explorerDetail );
ExplorerTree explorerTree = new ExplorerTree ( );
explorerTree.setThinBeanName ( EXPLORER_TREE_NAME );
explorerTree.setBIContext ( biHttpSession.getMetadataManager ( ).getMDRoot (
) );
handler.registerThinBean ( explorerTree );
explorerTree.setExplorerDetail ( explorerDetail );
explorerTree.setSearchVisible ( false );
The application adds a listener with the ExplorerDetail thin bean. The thin bean fires an event when an open or delete event occurs on the client. The servlet can open or delete a view using the information in the event.
For opening a view:
Hashtable env = new Hashtable ( );
QueryManager queryManager = biHttpSession.getQueryManager ( );
if ( queryManager != null ) {
env.put ( Query.QUERY_MANAGER, queryManager );
}
biHttpSession.getMetadataManager ( ).getMDRoot ( ).lookup ( location, ( Persistable
) dataView, env );
If the view was opened successfully, the application can change the current page to be the Analyze page. When opening a view, the application should clean up previously opened views if they are no longer required.
For deleting a view:
biHttpSession.getMetadataManager ( ).getMDRoot (
).unbind ( location );
The application can render the HTML using a combination of raw HTML and thin beans. For rendering HTML, the application can retrieve the PrintWriter from the HttpResponse object and use println statements to output HTML to the client.
response.setContentType ( "text/html" );
PrintWriter out = response.getWriter ( );
The thin beans are added to a FormBean UIX component. For example, to render the Open Report page.
FormBean rootNode = new FormBean ( PAGE_OPEN_REPORT );
ExplorerTree explorerTree = ( ExplorerTree ) handler.getThinBean ( EXPLORER_TREE_NAME
);
if ( explorerTree != null ) {
ExplorerTreeBean explorerTreeBean = new ExplorerTreeBean ( explorerTree
);
rootNode.addIndexedChild ( explorerTreeBean );
}
ExplorerDetail explorerDetail = ( ExplorerDetail ) handler.getThinBean ( EXPLORER_DETAIL_NAME
);
if ( explorerDetail != null ) {
ExplorerDetailBean explorerDetailBean = new ExplorerDetailBean ( explorerDetail
);
rootNode.addIndexedChild ( explorerDetailBean );
}
rootNode.addIndexedChild ( new FormValueBean ( CURRENT_PAGE_PARAM, PAGE_OPEN_REPORT
) );
Note that the current page is added as a hidden value in the form.
While cleaning up the BIHttpSession related to a client, the resources allocated by the Servlet need to be cleaned up. This includes thin beans allocated by the servlet for the session. The close method (implemented by QueryClient) should be called to release datasource related resources.
To run the BIMultiplePageServlet example within JDeveloper, simply right-click BIMultiplePageServlet.java under multiple_page_application.jpr, and choose Run BIMultiplePageServlet.java. When the application shows up on a browser, enter the username and password of the user that owns the BI Beans Catalog (e.g. BIBCAT). You can click on any of the presentation (view) name to see the presentation (view) on a second page.
![]() |
|
---|---|
Copyright © 2002, 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. |