Create and Register Portlets

Oracle WebCenter Framework is an extension for JDeveloper that assists with the creation and deployment of WebCenter applications, Oracle PDK-Java portlets, and standards-based Java portlets (JSR 168). Oracle WebCenter Framework provides two portlet creation wizards: Create JSR 168 Java Portlet wizard and Create Oracle PDK-Java Portlet wizard. Use the Create JSR 168 Java Portlet Wizard to build portlets based on the JSR 168 standard. Use the Create Oracle PDK-Java Portlet Wizard to build portlets based on the Oracle Application Server Portal Developer Kit for Java (Oracle PDK-Java) APIs.

Create an Oracle PDK-Java Portlet: Use the Create Oracle PDK-Java Portlet wizard to create a Java portlet for deployment to J2EE-compliant Web servers.

Create a Standards-based Java Portlet (JSR 168): Use the Create JSR 168 Java Portlet wizard to create a Standards-based Java Portlet (JSR 168), which runs on portals enabled for Web Services for Remote Portlets (WSRP).

Create a WebCenter Application: Use the WebCenter Application template to create a WebCenter application.

Register an Oracle PDK-Java Portlet Producer: Use the Register Oracle PDK-Java Portlet Producer wizard to register an Oracle PDK-Java portlet producer. Once the producer is registered, your consumer (for example, a WebCenter application) can communicate with portlets through this producer.

Register a WSRP Portlet Producer: Use the Register WSRP Portlet Producer wizard to register a WSRP portlet producer. Standards-based Java portlets (JSR 168) deployed to Oracle's portlet container are automatically exposed through WSRP. Once the WSRP portlet producer is registered, your consumer, such as a WebCenter application, can communicate with portlets through this producer.

Add Portlets to a JSF Page: Add portlets to a JSF page by dragging and dropping them onto the page. After that, you can run the page to see the portlets in action.

 

Create a Portlet Producer Application

tell me more icon Creating a Portlet Producer Application

You can create your Oracle PDK-Java portlet and Standards-based Java portlet (JSR 168) in any application scoped to create portlets. In this cue card, we will use the Portlet Producer Application template. This template preconfigures your application for creation of portlets.  [ tell me more...]





  1. Open the Create Application dialog [ File > New > Application.
  2. On Step 1, in the Application Name field, enter MyWebCenterPortletApp, to follow along with the example.
  3. In the Directory field, specify a directory.
  4. Leave the A pplication Package Prefix field blank. Optionally, you can enter a prefix to use for packages created within this application.
  5. From the Applica tion Template list, select Portlet Producer Application and click Next .
  6. On Step 2, click Next to accept the default values.
  7. On Step 3, click Finish .

    tell me more icon In the IDE

    When you create your application using the Portlet Producer Application template, the Application Navigator should look like this:   [ tell me more...]



 

Create an Oracle PDK-Java Portlet

tell me more icon Creating an Oracle PDK-Java Portlet

You can use the Create Oracle PDK-Java Portlet wizard to create your own Java portlets using Oracle's PDK-Java APIs. The Create Oracle PDK-Java Portlet Wizard simplifies portlet development by providing commonly required functions such as personalization and portlet parameterization. This wizard enables you to create portlets without having to deal directly with the complexity of communications between the web server and the portlet producer.  [ tell me more...]





  1. In the Application Navigator, select the Portlets project and launch the Create Oracle PDK-Java Portlet wizard [ New > Web Tier > Portlets > Oracle PDK-Java Portlet] .
  2. On step 1, in the Provider Name field, enter myprovider as the name, and ensure all the checkboxes are selected.
  3. On step 2, enter MyPDKPortlet as the portlet name, My PDK Portlet as the display name, and This is my Oracle PDK-Java portlet. as the description. Then select the default values for the timeout interval information and click Next .
  4. On step 3, select Show Details Page, and ensure JSP is the implementation style for both the Show Page and Show Details Page, then click Next .
  5. On step 4, select Edit Page and Edit Defaults Page, and ensure JSP is the implementation style for both pages, then click Next .
  6. On step 5, select Help Page and About Page, and ensure JSP is the implementation style for both pages, then click Next .
  7. On step 6, click Add, and accept the default input parameter values.
  8. On step 7, accept the default and then click Finish .
  9. Click File > Save All Save All to save your work.

    tell me more icon In the IDE

    When you create your Oracle PDK-Java portlet, the Application Navigator should look like this:  [ tell me more...]



 

Create a Standards-Based Java Portlet (JSR 168)

tell me more icon Creating a Standards-Based Java Portlet (JSR 168)

JSR 168 is a standard Java application programming interface (API) for creating Java portlets that run on portals enabled for Web Services for Remote Portlets or WSRP. The JSR 168 standard defines the following:  [ tell me more...]





  1. In the Application Navigator, select the Portlets project and launch the Create JSR 168 Java Portlet wizard [ New > Web Tier > Portlets > Standards-based Java Portlet (JSR 168)] .
  2. On step 1, enter MyPortlet for Name and Class and select the Enable users to edit portlet content and Enable inter-portlet communication using Oracle WSRP V2 extensions checkboxes, then click Next .
  3. On steps 2 through 7, click Next to accept the default values.
  4. On step 8, accept the default values. This step displays because you selected the Enable inter-portlet communication using Oracle WSRP V2 extensions checkbox on step 1.
  5. Click Finish .
  6. Click File > Save All Save All to save your work.

    tell me more icon In the IDE

    When you create your JSR 168 Java portlet, the related files display under the Portlets project of your application. One of the generated files, portlet.xml, which displays under WEB-INF, defines the characteristics and behavior of your JSR 168 portlet, for example, the different display modes that your portlet supports. The options you selected in the Create JSR 168 Java Portlet wizard are also saved to this file.  [ tell me more...]



 

Create a WebCenter Application

tell me more icon Creating a WebCenter Application

Now that you have created a portlet application, you must create a new application to consume your portlets. In this cue card, we will create a WebCenter application using the WebCenter Application template. To create a new WebCenter application, open the Create Application dialog by clicking New Application in the Application Navigator.  [ tell me more...]





  1. Open the Create Application dialog [ File > New > Application.
  2. On Step 1, in the Application Name field, enter MyWebCenterApp, to follow along with the example.
  3. In the Directory field, specify a directory.
  4. Leave the Application Package Prefix field blank. Optionally, you can enter a prefix to use for packages created within this application.
  5. From the Applica tion Template list, select WebCenter A pplication and click Next .

    tell me more icon WebCenter Application Template

    The WebCenter Application template contains the necessary technology scope for including Oracle WebCenter features in your application, such as Oracle Composer, the Resource Palette, task flows, content integration, and WebCenter Services. The WebCenter Application template also divides the application into two projects:  [ tell me more...]



  6. On Steps 2 through 4, click Next on these pages to accept the default values.
  7. On Step 5, click Finish .

    tell me more icon In the IDE

    When you create your application and projects using the WebCenter Application template, the Application Navigator should look like this:   [ tell me more...]



 

Register an Oracle PDK-Java Portlet Producer

tell me more icon Registering an Oracle PDK-Java Portlet Producer

To enable your PDK-Java portlet to be consumed by your application, you must first deploy the portlet to a portlet producer. Then, you can register the portlet producer with your application and use the portlet. For this example, however, you will register one of the prepackaged Oracle PDK-Java portlet producers that ships with the Default Server (Integrated WLS Server). To retrieve the URL of your preconfigured PDK-Java portlet producer, start the Default Server by selecting Start Server Instance (IntegratedWebLogicServer) from the Run menu.  [ tell me more...]





  1. From the Run menu, select Start Server Instance (IntegratedWebLogicServer) to start the Default Server.
  2. From the Help menu, select WebCenter Preconfigured Server Readme to display the readme file.
  3. In the PDK-Java Portlet producers section, click PDK-Java Sample Producer.

    tell me more icon Preconfigured Portlet Producers

    The WebCenter Preconfigured Server Readme page includes links to preconfigured portlet producers such as WSRP, PortalTools, and PDK-Java.   [ tell me more...]



  4. Copy the URL of the Web Provider Test Page: http://localhost:7101/jpdk/providers.

    tell me more icon PDK-Java Sample Producer

    To access the producer URL, click the PDK-Java Sample Producer link.   [ tell me more...]



  5. In the Application Navigator, under MyWebCenterApp, select the ViewController project and  [ New > Web Tier > Portlets > Oracle PDK-Java Producer Registration

    tell me more icon In the IDE

    The PDK-Java producer that you registered is now included as a resource for your application:  [ tell me more...]



 

Register a WSRP Portlet Producer

tell me more icon Registering a WSRP Portlet Producer

To enable your WSRP portlet to be consumed by your application, you must first deploy the portlet to a portlet producer. Then, you can register the portlet producer with your application and use the portlet. For this example, however, you will register one of the prepackaged WSRP portlet producers that ships with the Default Server (Integrated WebLogic Server). To retrieve the URL of your preconfigured WSRP portlet producer, start the Default Server by selecting Start Server Instance from the Run menu.  [ tell me more...]





  1. In the WebCenter Preconfigured Server Readme page, under the WSRP Portlet Producers section, click Sample Portlets.

    tell me more icon Sample Portlets

    The WebCenter Preconfigured Server Readme page includes links to preconfigured WSRP Portlet Producers.   [ tell me more...]



  2. In the WSDL URLS section, click WSRP v2 WSDL and copy the URL of the WSDL page: http://localhost:7101/portletapp/portlets/wsrp2?WSDL.

    tell me more icon WSRP v2 WSDL

    Oracle WebCenter supports Web Services for Remote Portlets (WSRP) versions 1.0 and 2.0. In the WebCenter Preconfigured Server page, you will find sample preconfigured portlets for both versions. In this example, you will use the WSRP v2 WSDL link. WSRP 2.0 support is for a preliminary (that is, pre-production) version of WSRP 2.0. This standard provides support for inter-portlet communication and export or import of portlet customizations.  [ tell me more...]



  3. In the Application Navigator, select the Portlets project and launch the Register WSRP Portlet Producer wizard [ New > Web Tier > Portlets > WSRP Producer Registration] .
  4. On step 1, select Application Resources to create the producer connection within the application.
  5. On the Target Project dropdown list, accept the default value.
  6. In the Producer Registration Name field, enter MyWSRPProducer as the name and click Next .
  7. On step 2, in the WSDL URL field, enter the URL of the WSDL page: http://localhost:7101/portletapp/portlets/wsrp2?WSDL. Leave the other fields blank, then click Next .
  8. On step 3, accept the default value and click Finish .

    tell me more icon In the IDE

    When registration is successful, the newly registered producer displays in JDeveloper under Application Resources. All the portlets of the producer are listed under this WSRP producer. You can select these portlets and drag them onto your JSF page.  [ tell me more...]



 

Add Portlets to a JSF Page

tell me more icon Adding Portlets to a JSF Page

Now that you have registered the portlet producer, you can add the portlet to your JSF page. To add portlets to a JSF page, first create a JSF page, then drag the portlets (Oracle PDK-Java and WSRP) onto the page from the Application Resources panel. You can then run the page.  [ tell me more...]





  1. In the Application Navigator, select the ViewController project and launch the Create JSF Page dialog  [ New > JSF > JSF Page]  to create a JSF page.
  2. In the File Name field, enter myPage as the name for your JSF page.
  3. Select the Create as XML Document (*.jspx) checkbox and click OK.
  4. Under Application Resources, expand Oracle PDK-Java Producer, then expand MyPDKProducer.
  5. From the list of portlets, drag and drop the Lottery Portlet onto the page.
  6. Under Application Resources, expand WSRP Producer, then expand MyWSRPProducer.
  7. From the list of portlets, drag and drop the Hello World Portlet onto the page.
  8. Click File > Save All Save All to save your work.
  9. Right-click myPage.jspx and select Run to see the page with its portlets in a browser.

    tell me more icon In the IDE

    When you add portlets to your JSF page, the Design view should look like this:  [ tell me more...]



 



Copyright © 1997, 2009, Oracle. All rights reserved.

false ,,,,,,,,,,,,,,,