# Oracle Business Intelligence Beans Sample

## Enabling Partial Page Rendering

### Overview

The `BIPPRToolbarServlet` class demonstrates how to enable Partial Page Rendering (PPR) in the `BIToolbarServlet`. This class inherits toolbar functionality from `BIToolbarServlet`. In response to user interaction, this sample uses PPR to update the page so that the user does not experience a loss of context.

### Code Highlights

The following section provides a walkthrough and explanations of the code fragments.

After the view and the toolbar are initialized, the following code enables PPR for the toolbar and sets IDs of the partial target nodes that should be rendered when PPR is enabled.

`viewToolbar.setPartialRenderEnabled(true);
viewToolbar.setPartialTargets(new String[]{PRESENTATION_NAME});
`

The application can render the HTML by using a combination of raw HTML and thin beans. However, the HTML body must be a UIX component, or the full page will be rendered.

`FormBean rootNode = new FormBean(FORM_NAME, request.getRequestURI()+"?foo="+Integer.toString(m_pageCount));
rootNode.setMethod("POST");
`

The thin beans are added to a `BodyBean` UIX component.

`BodyBean body = new BodyBean();
body.addIndexedChild(rootNode);`

The following call creates the `PartialPageContext` from the `ServletRequest`:

`PartialPageContext partialContext = PartialPageEventUtils.createPartialPageContext(request);`

The thin beans in a `FormBean` UIX component are rendered as follows: The page is partially rendered if the `PartialPageContext` is specified, or fully rendered if the `PartialPageContext` is `null`.

`ServletRenderingContext renderingContext = new ServletRenderingContext(this, request, response, out);
PartialPageUtils.renderPartialPage(renderingContext, body, partialContext);
`

While the code cleans up the `BIHttpSession` that is related to a client, the resources allocated by the servlet need to be cleaned up. This includes beans that the servlet allocates for the session. The `close` method (implemented by `QueryClient`) should be called to release resources that are related to the data source. The `cleanUp` method should be called on the `ThinGraph` to release Graph-related resources.

Copyright © 2004 Oracle Corporation. All Rights Reserved.