Skip Headers
Oracle® Fusion Middleware Developer's Guide for Oracle WebCenter
11g Release 1 (11.1.1.5.0)

Part Number E10148-16
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

59 Creating Portlets with the Portlet Wizard

This chapter explains how to create Java portlets based on the Java Portlet Specification (JSR 286) or the Oracle Portal Developer Kit-Java (PDK-Java) in a WebCenter portlet application, using the Create JSR 286 Java Portlet and Create Oracle PDK-Java Portlet wizards.

This chapter includes the following sections:

59.1 Introduction to Java Portlets

This section includes the following sections:

59.1.1 Introduction to Standards-Based Java Portlets

Organizations engaged in WebCenter Portal application projects have found application integration to be a major issue. Until now, users developed portlets using proprietary APIs for a single portal platform and often faced a shortage of available portlets from a particular portal vendor. All this changed with the introduction of the following standards:

  • Web Services for Remote Portlets (WSRP)

  • Java Specification Request (JSR) 286

These two standards enable the development of portlets that interoperate with different portal products, and therefore widen the availability of portlets within an organization. This wider availability can, in turn, dramatically increase an organization's productivity when building WebCenter Portal applications.

WSRP is a web services standard that enables the plug-and-play of visual, user-facing web services with portals or other intermediary web applications. Being a standard, WSRP enables interoperability between a standards-enabled container and any WSRP portal. WSRP defines the following:

  • Web Services Definition Language (WSDL) interface for the invocation of WSRP services

  • Markup fragment rules for markup emitted by WSRP services

  • The methods to publish, find, and bind WSRP services and metadata

JSR 286 is a specification that defines a set of APIs to enable interoperability between portlets and portals, addressing the areas of aggregation, personalization, presentation, and security. JSR 286 defines container services which provide the following:

  • A portlet API for coding portlet functionality

  • The URL-rewriting mechanism for creating user interaction within a portlet container

  • The security and personalization of portlets

  • Inter-portlet communication using portlet events and public render parameters

Oracle actively participates in portlet standards including those produced by the OASIS (WSRP) and JCP (JSR 168, 286, 301, 329, and so on) standards organizations.

Note:

HTML forms can be submitted using either the get or post method, but the WSRP standard only requires the consumer (WebCenter Portal application) to use the post method. Support of the get method is optional according to the standard. Since application consumers are not required to support the get method, Oracle recommends that you use the post method when developing your portlets.

The Relationship Between WSRP and JSR 286

WSRP is a communication protocol between a portlet client, for example, a WebCenter Portal application, and a portlet container running on a remote server. JSR 286 describes the Java Portlet API for running portlet applications. Combining these standards enables developers to integrate their applications from any internal or external source as portlets with WSRP portals. Building pages becomes as simple as selecting portlets from the JDeveloper Resource Palette or Application Resources pane of the Application Navigator.

Figure 59-1 shows the architecture of the WSRP specification.

Note:

Figure 59-1 illustrates the use of JSR 286 portlets with WSRP.

Figure 59-1 WSRP Specification Architecture

Shows JPS portlet containers and WSRP portal.
Description of "Figure 59-1 WSRP Specification Architecture"

Oracle WebCenter Framework can support communication between the WebCenter Portal application and both the Java Portlet APIs and our existing APIs (PDK-Java).

Figure 59-2 shows the architecture of the WSRP support. Notice that the JSR 286-compliant portlet container uses the WSRP protocol for communication and the PDK-Java portlet container uses Oracle's proprietary SOAP protocol for communication.

Figure 59-2 Oracle WebCenter Portlet Architecture

Shows PDK-Java and JPS portlets and WSRP portal.
Description of "Figure 59-2 Oracle WebCenter Portlet Architecture"

For a description of how JSR 286 security concepts are exposed through WSRP, see Section 67.17, "Securing Identity Propagation Through WSRP Producers with WS-Security."

59.1.2 Introduction to PDK-Java Portlets

PDK-Java gives you a framework to simplify the development of Java portlets by providing commonly required utilities and enabling you to leverage existing development skills and application components such as JSPs, servlets, and static HTML pages. PDK-Java also enables you to create portlets without having to deal directly with the complexity of communications between Oracle WebCenter Framework and producers.

The PDK-Java framework is divided into the following areas:

  • The Producer Adapter insulates the developer from the HTTP syntax defined by Oracle WebCenter Framework for communication with web producers. It translates the information passed between Oracle WebCenter Framework and your Java web producer. Without an adapter, your producer would not only manage portlets, but it would also have to communicate this information directly to Oracle WebCenter Framework in the expected language. The adapter eliminates the need for your web producer to understand the portal language and vice-versa.

  • The Producer Interface defines the APIs (functions) required by your Java implementation to integrate with the Producer Adapter. The Producer Adapter receives messages from the WebCenter Portal application, translates them into calls to the Producer Interface, and translates the producer's response into a format that the application can understand. The Producer Interface contains a set of Java classes that define the methods your producer implements and, in often, provides a standard implementation. Some of the primary classes are as follows:

    • ProviderDefinition (oracle.portal.provider.v2.ProviderDefinition)

    • ProviderInstance (oracle.portal.provider.v2.ProviderInstance)

    • PortletDefinition (oracle.portal.provider.v2.PortletDefinition)

    • PortletInstance (oracle.portal.provider.v2.PortletInstance)

    • ParameterDefinition (oracle.portal.provider.v2.ParameterDefinition)

    • EventDefinition (oracle.portal.provider.v2.EventDefinition)

  • The Producer Runtime provides a base implementation that follows the specification of the Producer Interface. The Producer Runtime includes a set of default classes that implement each of the Producer Interfaces and enables you to leverage the rendering, personalization, and security frameworks provided with PDK-Java. These classes and the associated frameworks simplify the development of a producer by implementing common functions for Oracle WebCenter Framework requests and providing a declarative mechanism for configuring the producer. Using the Producer Runtime, you can focus your development efforts on the portlets themselves rather than the infrastructure needed to communicate with the WebCenter Portal application. If the standard behavior of the Producer Runtime does not meet your requirements, then you can easily extend or override specific behaviors. Some of the primary classes are as follows:

    • DefaultProviderDefinition (oracle.portal.provider.v2.DefaultProviderDefinition)

    • DefaultProviderInstance (oracle.portal.provider.v2.DefaultProviderInstance)

    • DefaultPortletDefinition (oracle.portal.provider.v2.DefaultPortletDefinition)

    • DefaultPortletInstance (oracle.portal.provider.v2.DefaultPortletInstance)

    • PortletRenderer (oracle.portal.provider.v2.render.PortletRenderer)

    • PortletPersonalizationManager (oracle.portal.provider.v2.personalize.PortletPersonalizationManager)

    • PortletSecurityManager (oracle.portal.provider.v1.http.DefaultSecurityManager)

  • The Producer Utilities provide methods for simplifying the rendering of portlets. The utilities include methods for constructing valid links (hrefs), rendering the portlet's container (including the header), rendering HTML forms that work within a page, and supporting portlet caching.

For more information about the PDK-Java, see the Oracle Fusion Middleware Java API Reference for Oracle PDK Java.

59.2 Creating Java Portlets

Before you begin you should make sure:

Note:

The figures in this section were taken with the default Look and Feel (Oracle) and Theme (Fusion Blue) settings in JDeveloper. If you have changed these settings, then what you see on your screen may vary slightly, but the content and functionality remains the same. To change the Look and Feel and Theme settings, select Preferences from the Tools menu, and then select Environment.

This section includes the following subsections:

59.2.1 How to Create a JSR 286 Java Portlet

Using the Create JSR 286 Java Portlet wizard in JDeveloper you can expose your portlet over WSRP 2.0 quickly and easily. This wizard supports both WSRP 1.0 and WSRP 2.0.

In the Create JSR 286 Java Portlet wizard, you can choose which portlet modes you want to implement and the implementation method (JSP, HTTP servlet, Java class, or HTML) to use for each mode. The wizard then creates a simple implementation for each of the selected modes.

To create a JSR 286 Java portlet using the JDeveloper wizard:

  1. In the JDeveloper Application Navigator, open the application under which you want to create your portlet.

    The application must be scoped for portlet creation. An easy way to achieve this is to use the Portlet Producer Application template.

    Note:

    WebCenter Portal Applications are not scoped for portlet creation.
  2. Right-click the project under which you want to create your portlet (for example Portlets), and choose New.

  3. In the New Gallery, expand Web Tier, select Portlets and then Standards-based Java Portlet (JSR 286), and click OK.

    Note:

    If the project already contains JSR 286 portlets, you can also create a new portlet by:
    • Right-clicking portlet.xml and choosing Add Portlet.

    • Opening portlet.xml, clicking the Design tab, and clicking the Add icon on the Portlets tab.

  4. On the General Portlet Information page of the Create JSR 286 Java Portlet wizard (Figure 59-3), replace the default name provided in the Name field with one that better describes the purpose of the portlet.

    Figure 59-3 The General Portlet Information Page

    Shows General Portlet Properties page.
    Description of "Figure 59-3 The General Portlet Information Page"

  5. In the Class field, enter a name for the class for the portlet. You can accept the default name provided or supply your own. If you supply your own name, it must be a valid Java name.

  6. From the Package enter the name of the package in which to create the class, or select the package from the dropdown list.

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

  7. From the Default Language dropdown list, select the default language that your portlet supports. The wizard uses English by default.

  8. Select Enable users to edit portlet content if you want your portlet to support Edit mode. In the wizard, this option is selected by default.

    Edit mode enables users to personalize the portlet at runtime. For more information, see Section 57.1.3.2, "Edit Mode."

    If you select this option, you can specify implementation details for the portlet's Edit mode later on in the wizard.

  9. Click Next.

  10. On the Additional Portlet Information page (Figure 59-4), in the Portlet Title field, enter a descriptive title for your portlet.

    The portlet title is displayed in the Resource Palette or Application Resources panel, so make the title something to help users decide whether the portlet is useful to them. The portlet title is also displayed on the portlet header when the portlet appears on a page.

    Figure 59-4 The Additional Portlet Information Page

    Shows Name and Attribution page.
    Description of "Figure 59-4 The Additional Portlet Information Page"

  11. The Display Name, Short Title, Description, and Keyword attributes are not implemented in WebCenter Portal applications. You do not need to enter any values for these fields unless your portlet is likely to be consumed by other applications.

    For example, Oracle Portal uses the portlet display name in the Portlet Repository.

  12. At this point in the wizard, you can click Finish to create the portlet immediately, using the default values for all remaining settings.

    To provide additional details for your portlet, click Next and follow the remaining steps.

  13. On the Content Types and Portlet Modes page (Figure 59-5), in the Content Types and Portlet Modes list, select view.

    Figure 59-5 The Content Types and Portlet Modes Page

    Shows Content Types and Portlet Modes page.
    Description of "Figure 59-5 The Content Types and Portlet Modes Page"

  14. In the Implementation Method section, select how you want to implement View mode for your portlet (for more information about View mode, see Section 57.1.3.1, "View Mode"):

    • Select Generate JSP to generate a skeleton JSP file for the portlet mode. Enter a name for the JSP in the corresponding field, or accept the default.

      When you complete the wizard, the generated JSP displays in the Application Navigator where you can select it for further development. This is the default selection for all portlet display modes.

    • Select Generate ADF-Faces JSPX to generate a page to which you can add ADF-Faces components. Enter a name for the JSPX in the corresponding field, or accept the default.

      Note:

      If you choose this option, the portlet implementation class is created as a subclass of oracle.portlet.bridge.adf.application.ADFBridgePortlet, instead of as a subclass of javax.portlet.GenericPortlet. That is, the wizard generates a portlet application which uses the Oracle JSF Portlet Bridge. For more information about the Oracle JSF Portlet Bridge, see Chapter 58, "Creating Portlets with the Oracle JSF Portlet Bridge."
    • Select Map to Path to map the portlet mode to a web resource in the portlet application, such as a page. The resource is not generated by the wizard. Enter the name and path in the corresponding field. You can create this resource after completing the wizard if necessary.

      With this selection, you must write the targeted resource or file yourself. The target could be, for example, a JSP, a servlet, or an HTML file. This selection enters code in the generated portlet Java class that routes requests for the given mode to the specified target.

    • Select Custom Code to implement the portlet mode through a custom coded object. You must create this object later. This selection generates a skeleton method to render content (private void doMODE_NAMECONTENT_TYPE) in the generated portlet java class. You must update this code to render useful content.

    Note:

    If you want this portlet mode to support a different content type, for example text/xml, see Step 17.
  15. If you selected Enable users to edit portlet content on the first page of the wizard, select edit and then select the implementation method for Edit mode (for information about Edit mode, see Section 57.1.3.2, "Edit Mode").

  16. To implement another portlet mode for your portlet:

    1. In the Content Types and Portlet Modes list, select an existing mode (for example, view) under the appropriate content type (for example, text/html).

    2. Click Add.

    3. In the Portlet Modes dialog, move the required modes to the Selected list and click OK.

      The Portlet Modes dialog lists the standard modes supported by JSR 286 and the extended modes supported by WebCenter.

      For more information, see Section 57.1.3, "Portlet Modes."

    4. Select each of the portlet modes and specify the implementation method to use for rendering content, as described in step 14.

  17. To add a new content type:

    1. In the Content Types and Portlet Modes list, select an existing content type (for example, text/html).

    2. Click Add.

    3. In the Content Types dialog, move the required content types to the Selected list and click OK.

  18. Click Next.

    If you selected Enable users to edit portlet content on the General Portlet Information page earlier in the wizard, then you can create customization preferences to enable users of the portlet to specify values for the portlet at runtime. Go to step 19.

    If you did not select this option, go to step 24.

  19. On the Customization Preferences page (Figure 59-6), click Add to add a new customization preference to the portlet.

    By default, the wizard includes a customization preference to enable users to customize the portlet title.

    Figure 59-6 The Customization Preferences Page

    Shows Customization Preferences page.
    Description of "Figure 59-6 The Customization Preferences Page"

  20. In the Add New Preference dialog, in the Name field, enter a name for the new preference.

    The name must be unique in the portlet. Use only letters, numbers, and the underscore character.

  21. In the Default Values field, enter one or more default values for the new preference. Separate multiple values with commas.

  22. To make the preferences translatable, select the Translate Preference checkbox and then click OK.

    JDeveloper generates a resource bundle class for translatable preferences, with strings for which you can obtain translations. At runtime, the portlet references the resource bundle entries.

    Note:

    The preference name is always translated, but there is not always a requirement to translate the default values. For example, if the value is an integer, then no translation is needed.
  23. Repeat the preceding steps to add more preferences. When you are done click Next.

  24. On the Security Roles page (Figure 59-7), to add an existing security role to your portlet, select the security role and move it to the Selected list.

    Security roles enable you to set tiered levels of access to the portlet. For example, a View user can view the portlet but cannot edit it; a Customize user can customize portlet settings; a Manage user can perform all available functions associated with the portlet.

    The Available list displays the security roles defined for the application in which you are creating the portlet. Moving a security role to the Selected list creates a reference of the security role in the application's portlet deployment file (portlet.xml) that refers to the security role in the application's web deployment file (web.xml).

    You can create new security roles for the application by editing web.xml. For more information, see the JDeveloper online help.

    Figure 59-7 The Security Roles Page

    Shows Security Roles page.
    Description of "Figure 59-7 The Security Roles Page"

  25. Click Next.

  26. On the Caching Options page (Figure 59-8), select Cache Portlet to enable expiry-based caching for your portlet.

    Selecting this option indicates that portlet caching is managed by the portlet container. The portlet itself may choose to cache content for any given response. The settings on this page apply only when the portlet itself does not specify a caching condition for a response.

    If you do not want any default caching for this portlet, choose Do Not Cache By Default. In this case, the wizard actually sets a cache duration of 0 seconds. As stated earlier, this cache setting only comes into play when the portlet itself does not specify a caching condition for a response.

    If you choose no caching here and you later decide to implement default caching for the portlet, then you can change the cache duration value in the portlet.xml file, which is generated by the wizard, to a number greater than zero.

    For more information, see Section 60.2.9.1, "Implementing Expiry-Based Caching."

    For information about how to implement validation-based caching, see Section 60.2.9.2, "Implementing Validation-Based Caching."

    Figure 59-8 The Caching Options Page

    Shows Caching page.
    Description of "Figure 59-8 The Caching Options Page"

  27. If you chose to cache the portlet, in the Default Expiry Conditions section, select:

    • Cache Content Expires After [ ] seconds to expire the cached portlet content after a certain amount of time. Specify the time limit in the corresponding field.

    • Cache Content Never Expires to never expire the cached portlet content. You may want to select this option if the portlet contains static content that is unlikely to change.

  28. Click Next.

  29. On the Initialization Parameters page (Figure 59-9), you can add initialization parameters to your portlet.

    Initialization parameters provide the application developer, who decides what goes into the .war file, an alternative to JNDI variables for configuring the behavior of all of the different components of the application (for example, servlets and portlets) in a compatible way. These initialization parameters are added to the portlet.xml file.

    1. Click New to add a new initialization parameter to the portlet.

    2. In the newly added row, double-click each field to provide a Name, default Value, and Description for the parameter.

    3. Repeat these steps to add more initialization parameters.

    4. When you are done, click Finish.

    Figure 59-9 The Initialization Parameters Page

    Shows Initialization Parameters page.
    Description of "Figure 59-9 The Initialization Parameters Page"

59.2.2 What Happens When You Create a JSR 286 Java Portlet Using the JDeveloper Wizard

When you use the JDeveloper wizard to create a JSR 286 Java portlet, JDeveloper generates a default implementation of the portlet. Specifically, the following files are created:

  • Two Java classes:

    • portletName.java is invoked by the portlet container and contains all the methods required by the portlet standards.

    • portletnameBundle.java contains all the translation strings for the portlet.

  • portlet.xml is the portlet deployment descriptor file for the application.

  • web.xml is the web deployment descriptor file for the application.

  • Files for each portlet mode you selected for the portlet:

    • If you selected Generate JSP for the portlet mode, a JSP page is created for the mode, for example, view.jsp.

    • If you selected Generate ADF-Faces JSPX, a JSPX page is created for the mode, for example, view.jspx. You can add Faces components to this page.

    • If you selected Map to Path, no additional files are created as the code for the portlet mode resides in an existing resource. Code is added to the portlet's Java class to route requests to the specified target.

    • If you selected Custom Code, no additional files are created, but the code for the portlet mode resides in the portlet's Java class.

You can see all these files in the Application Navigator, as shown in Figure 59-10.

Figure 59-10 Files Generated for a JSR 286 Java Portlet

Shows contents of the Applications - Navigator.
Description of "Figure 59-10 Files Generated for a JSR 286 Java Portlet"

59.2.3 After You Create a JSR 286 Java Portlet Using the JDeveloper Wizard

The next step is to extend the sample code with your own business logic to implement the desired functionality and features for your portlet. For more information, see the JSR 286 specification at:

http://jcp.org/en/jsr/detail?id=286

You can change the portlet's settings by editing the portlet.xml file. JDeveloper provides an Overview Editor to enable you to easily edit portlet.xml. For more information, see Section 60.2.1, "How to Edit the Portlet Deployment Descriptor File."

59.2.4 How to Create a PDK-Java Portlet

Using the Create Oracle PDK-Java Portlet wizard in JDeveloper you can quickly and easily create PDK-Java portlets. You can choose which portlet modes you want to implement and the implementation method (JSP, HTTP servlet, Java class, or HTML) to use for each mode. The wizard then creates a simple implementation for each of the selected modes.

To create a PDK-Java portlet using the JDeveloper wizard:

  1. In the JDeveloper Application Navigator, open the application under which you want to create your portlet.

    The application must be scoped for portlet creation. An easy way to achieve this is to use a Portlet Producer Application. WebCenter Portal Applications are not scoped for portlet creation.

  2. Right-click the project under which you want to create your portlet, and choose New.

    Note:

    To create the portlet in an existing producer, right-click the producer's provider.xml file and choose Add Portlet. This takes you directly to the General Portlet Information page of the Create Oracle PDK-Java Portlet wizard (step 8).
  3. In the New Gallery, expand Web Tier, select Portlets and then Oracle PDK-Java Portlet, and click OK.

    Note:

    Selecting Oracle PDK-Java Portlet opens the wizard for creating PDK-Java portlets. Selecting Standards-based Java Portlet opens the wizard for creating JSR 286-compliant portlets.
  4. On the Provider Details page of the Create Oracle PDK-Java Portlet wizard (Figure 59-11), enter a name for the new producer to contain your portlet. This name must be unique within the project.

    In the PDK-Java, the term provider is used instead of producer. A provider is the same thing as a producer.

    Figure 59-11 The Provider Details Page

    Shows Provider Description page.
    Description of "Figure 59-11 The Provider Details Page"

  5. Select Generate Deployment Properties File.

    This automatically generates two .properties files:

    • serviceID.properties defines properties for a producer with that service ID. The service ID has the same value as the producer name.

    • _default.properties is a default properties file. A producer application may have multiple producers, each with its own service ID. On registration, if no service ID is defined, then the default properties file is used.

  6. Select Generate XML Entries.

    This automatically generates a producer definition file (provider.xml) for the producer that contains details of the portlets belonging to the producer, including those generated by the wizard.

  7. Select Generate Index JSP and then click Next.

    This automatically generates an index.jsp file that lists all the producers that reside in the application with hyperlinks that enable easy access to producer test pages.

  8. On the General Portlet Information page (Figure 59-12), enter a name and display name for your portlet.

    The name is used internally and is not exposed to users. The display name is displayed to users in portlet selection lists, such as the Component Palette.

    The description is not implemented in WebCenter Portal applications so you do not need to enter a value in this field unless your portlet is likely to be consumed by other applications, such as Oracle Portal.

    Figure 59-12 The General Portlet Information Page

    Shows Portlet Description page.
    Description of "Figure 59-12 The General Portlet Information Page"

  9. In the Timeout Interval (Seconds) field, enter the number of seconds to allow for rendering the portlet.

  10. In the Timeout Message field, enter a message to display if the rendering of the portlet exceeds the timeout interval specified and then click Next.

  11. On the View Modes page (Figure 59-13), under Show Page, from the Implementation Style dropdown list, select the implementation style to use for the portlet's Shared Screen mode.

    • Select JSP to implement the portlet's Shared Screen mode as a JavaServer Page. In the File Name field, enter the name of the file to be generated by the wizard.

    • Select HTTP Servlet to implement the portlet's Shared Screen mode as an HTTP servlet. In the Package Name field, enter the name of the package that contains the HTTP servlet. In the Class Name field, enter the Java class to be referenced with the portlet's Shared Screen mode.

    • Select HTML File to implement the portlet's Shared Screen mode as an HTML file. In the File Name field, enter the name of the file to be generated by the wizard. Note that, when you choose HTML File, the following code is added inside the <renderer> element of your provider.xml file:

      <showPage class="oracle.portal.provider.v2.render.http.ResourceRenderer">
          <resourcePath>provider_id/portlet_name/file.html</resourcePath>
          <contentType>content_type</contentType>
          <charSet>char_set</charSet>
       </showPage>
      

      charSet indicates the character set that the producer must use to encode the HTML page. The default character set is determined by JDeveloper preferences. If you require a different character set, you must update this element of provider.xml accordingly.

    • Select Java Class to implement the portlet's Shared Screen mode as a Java class. In the Package Name field, enter the name of the package that contains the Java class. In the Class Name field, enter the name of the Java class.

    For more information about Shared Screen mode, see Section 57.1.3.1, "View Mode."

    Figure 59-13 The View Modes Page

    Shows Show Modes page.
    Description of "Figure 59-13 The View Modes Page"

  12. To implement Full Screen mode for your portlet, select Show Details Page and then select an implementation style as described for Full Screen mode in step 11.

    For more information about Full Screen mode, see Section 57.1.3.7, "Full Screen Mode (PDK-Java)."

  13. At this point in the wizard, you can click Finish to create the portlet immediately, using the default values for all remaining settings.

    To provide additional details for your portlet, click Next and follow the remaining steps.

  14. On the Customize Modes page (Figure 59-14), Edit Page is selected by default. To implement Edit mode for your portlet, select an implementation style as described for Shared Screen mode in step 11. If you do not want to implement Edit mode, then deselect Edit Page.

    For more information about Edit mode, see Section 57.1.3.2, "Edit Mode."

    Figure 59-14 The Customize Modes Page

    Shows Customize Modes page.
    Description of "Figure 59-14 The Customize Modes Page"

  15. To implement Edit Defaults mode for your portlet, select Edit Defaults Page, and then select an implementation style as described for Shared Screen mode in step 11.

    For more information about Edit Defaults mode, see Section 57.1.3.3, "Edit Defaults Mode."

  16. Click Next.

  17. On the Additional Modes page (Figure 59-15), to implement Help mode for your portlet, select Help Page, and then select an implementation style as described for Shared Screen mode in step 11.

    For more information about Help mode, see Section 57.1.3.4, "Help Mode."

    Figure 59-15 The Additional Modes Page

    Shows Additional Modes page.
    Description of "Figure 59-15 The Additional Modes Page"

  18. To implement About mode for your portlet, select About Page, and then select an implementation style as described for Shared Screen mode in step 11.

    For more information about About mode, see Section 57.1.3.5, "About Mode."

  19. Click Next.

  20. On the Public Portlet Parameters page (Figure 59-16), click Add to add a public parameter to your portlet.

    This adds a new row to the table of parameters. Double-click each field in the row to provide a name, display name, and description for the parameter.

    Repeat this step to add more public parameters. When you are done, click Next.

    Public portlet parameters enable a portlet to communicate with the page on which it resides and with other portlets on that page. For more information, see Section 60.3.3, "How to Implement Public Parameters."

    Figure 59-16 The Public Portlet Parameters Page

    Shows Public Portlet Parameters page.
    Description of "Figure 59-16 The Public Portlet Parameters Page"

  21. Oracle PDK-Java events are not supported in WebCenter Portal applications, so On the Public Portlets Events page, click Finish.

    For more information about events, see the Oracle Fusion Middleware Developer's Guide for Oracle Portal.

59.2.5 What Happens When You Create a PDK-Java Portlet

When you use the JDeveloper wizard to create a PDK-Java portlet, JDeveloper generates a default implementation of the portlet. Specifically, the following files are created:

  • Files for each portlet mode you selected, for example portletnameEditPage.jsp.

  • provider.xml is the producer definition file that contains details of the portlets belonging to the producer.

  • web.xml is the web deployment file for the application.

  • weblogic.xml includes a shared library definition pointing to the PDK-Java shared library.

  • index.jsp is used by JDeveloper for testing purposes.

  • _default.properties is the default properties file.

  • serviceID.properties is the properties file for the producer identified by serviceID.

All these files are required to deploy and run the portlet successfully, except for index.jsp.

You can see all these files in the Application Navigator, as shown in Figure 59-17.

Figure 59-17 Files Generated for a PDK-Java Portlet

Shows contents of Applications - Navigator.
Description of "Figure 59-17 Files Generated for a PDK-Java Portlet"

59.2.6 After You Create an Oracle PDK-Java Portlet Using the JDeveloper Wizard

The next step is to extend the sample code with your own business logic to implement the desired functionality and features for your portlet.

For more information about the PDK-Java, see the Oracle Fusion Middleware Java API Reference for Oracle PDK Java.

59.3 Troubleshooting Java Portlets

This section provides information to assist you in troubleshooting problems you may encounter while creating portlets using the Create Portlet Wizards.

59.3.1 Cannot Access the Create Portlet Wizard

Problem

In the New Gallery, I cannot find the Oracle PDK-Java Portlet or Standards-based Java Portlet (JSR 286) options.

Cause

The application in which you are trying to create the JSR 286 or PDK-Java portlet is a WebCenter Portal Application and therefore is not scoped for portlet creation.

Solution

  1. Try creating the portlet in a Portlet Producer Application or any application scoped for portlet creation (any application except for WebCenter Portal Application).

  2. In the New Gallery, click the All Technologies tab to list all available options regardless of the technology scope of the application.

59.3.2 Cannot Add the Portlet Functionality that I Want to the Portlet

Problem

I cannot find the option to add certain features, for example portlet events or public render parameters, to the portlet in the Create Portlet Wizard.

Cause

The Create Portlet Wizard does not provide the option to add certain features to portlets.

Solution

After you create the portlet using the Create Portlet Wizard, edit the portlet.xml file using the Overview Editor to add advanced functionality. For more information, see Section 60.2, "Enhancing JSR 286 Java Portlets."