Introduction to Java Portlet Specification JPS and WSRP

6-14 Oracle Fusion Middleware Developers Guide for Oracle Portal Figure 6–4 Oracle Portals WSRP Architecture

6.3 Building JPS-Compliant Portlets with Oracle JDeveloper

Using the JSR 168 Portlet Wizard in Oracle JDeveloper you can expose your portlet over WSRP quickly and easily. This section assumes the following: ■ You are familiar with portlet terminology such as portlet Show modes. See Chapter 1, Understanding Portlets and Section 6.1, Guidelines for Writing Java Portlets. ■ You are already familiar with Oracle JDeveloper and know how to build and deploy Java components using it. You can download Oracle JDeveloper from OTN. Visit the Oracle JDeveloper page on OTN: http:www.oracle.comtechnologyproductsjdevindex.html This section contains the following subsections: ■ Section 6.3.1, Creating a JSR 168 Portlet ■ Section 6.3.2, Adding Portlet Logic to Your JSR 168 Portlet ■ Section 6.3.3, Deploying Your JSR 168 Portlet to the Oracle WebLogic Server ■ Section 6.3.4, Registering and Viewing Your JSR 168 Portlet ■ Section 6.3.5, Registering WSRP Producers in Enterprise Configurations

6.3.1 Creating a JSR 168 Portlet

This section walks you through the JSR 168 Java Portlet Wizard. You can choose which portlet Show modes you want to implement and the implementation method JSP, HTTP servlet, Java class, or HTML. The wizard then creates a simple sample implementation for each of the selected modes. The steps to create a portlet using the JSR 168 Java Portlet Wizard are as follows: 1. Start Oracle JDeveloper. 2. In the Application Navigator, expand the application under which you want to create your portlet. Creating Java Portlets 6-15 3. Right-click the project under which you want to create your portlet, and select New.

4. In New Gallery, expand Web Tier, select Portlets and then Standards-based Java

Portlet JSR 168 see Figure 6–5 . Figure 6–5 New Gallery Dialog Box for Standards-based Java Portlet

5. Click OK to display the General Portlet Information page see

Figure 6–6 . Note: If you do not have a project yet, you can create one in one of the following two ways: ■ Right-click an existing application in the Application Navigator and choose New Project. Select Empty Project and click OK. Fill out the Create Project dialog box and click OK. ■ Right-click the Applications node and choose New Application. Fill out the Create Application dialog box and click OK. When the Create Project dialog box appears, fill it out and click OK. Note: Selecting Standards-based Java Portlet opens the Portlet Wizard for creating JPS-compliant portlets. Selecting Oracle PDK-Java Portlet opens the Portlet Wizard for creating PDK-Java portlets. 6-16 Oracle Fusion Middleware Developers Guide for Oracle Portal Figure 6–6 General Portlet Information Page

6. In the Name field, enter a name for the portlet. You can accept the default name or

enter your own.

7. In the Class field, enter a name for the class that the wizard will create for the

portlet. You can accept the default name provided or enter your own. If you supply your own name, it must be a valid Java name.

8. From the Package list, select the package in which the class will reside. Click the

Browse button to find packages within the project. If you do not select a specific package, the wizard uses the default package of the project.

9. From the Language list, select the default language that your portlet will support.

The wizard uses English by default.

10. If you want your portlet to support Edit mode, select Enable users to edit portlet

content . In the wizard, this option is selected by default.. If you select this option, you can specify the details for the Edit mode later on in the wizard.

11. If you want to create a portlet that supports Oracle WSRP 2.0 extensions, select

Enable inter-portlet communication using Oracle WSRP V2 extensions and then click Next. 12. In the Additional Portlet Information page see Figure 6–7 In the Display Name field, enter a name for your portlet. This name will be displayed in the Oracle Portal catalog or repository. Note: JSR 168 portlets built with Oracle extensions can be consumed by any consumer that supports WSRP 2.0. To leverage WSRP 2.0, the portlets must be deployed to the Oracle WebLogic Server.