Oracle9iAS Portal Developer Kit

Reusing Portlets (Based on the Sample Event Web Provider)

The PDK Sample Event Web Provider included with Oracle9iAS Portal showcases portlets that make use of public portlet parameters and events. This article shows a page designer how to reuse the Sample Event Web Provider portlet to perform a different function without altering the portlet code. For a discussion of parameters and events review the article A Primer on Parameters and Events.

SETTING UP THE SAMPLE

Follow the Designing Pages Using the Sample Event Web Provider article to properly setup the PDK Sample Event Web Provider.

NEW APPLICATIONS

This article will map the PDK sample to a Portal Report and Portal Chart that accepts the parameter 'deptno'.

- Create a Portal Chart and Portal Report based on the EMP table or use the following components from the EXAMPLE_APP Database Provider.
  - Report Built Using Wizard

  - Example Wizard Chart

- Make sure to add a public parameter called deptno to both of these components.

- Add both of these components to Page 1 (from the Designing Pages Using the Sample Event Web Provider article).

- View Page1. Here you see that the Report and Chart displays employees from all departments.

REUSING THE SAMPLE

1. Go to Page 1.

2. Edit Page 1 Properties.

3. Click on the Parameters tab and create a parameter called PageDeptno. Do not set any default values.

4. Under Portlet Parameter Values, map the Report and Chart portlet parameters to the Page Parameter, PageDeptno.

5. Click on OK.

6. Go to Page 2 and Edit Page Properties.

7. Click on the Events tab.

8. Expand All and click on Submit.

9. Submit should already be mapped to Page 1, so you should only need to map the Event Output of the Page Parameter, PageDeptno, to the portlet parameter, name. Leave everything else as it was before.

10. Click OK.

11. View Page 2 and enter 10 in the name textbox field and click on Submit. Notice that only employees from department 10 is displayed in the Portal Chart and Portal Report on Page 1. The Public Parameter Portlet still works and display 10 for the param1 field.

Note: The Event and Parameter Form portlet display Name and Age next to the textbox fields. For sample demonstration purposes, this text is hardcoded in the portlet code. When building a reusable portlet, you should either allow users to custom the names next to the textfield or use generic parameter names such as parameter1, parameter2.

Revision History:

June 24, 2002.