Creating portlet projects

 

+

Search Tips   |   Advanced Search

 

You can create and maintain resources for portlet applications using the Java Specification Request (JSR 168 and JSR 286) portlet API in a portlet project. Portlet projects can be added to a new or existing enterprise application project.

Note: The JSR 286 portlet API is supported by WebSphere Portal V7.0, or later; and by WAS 6.1, or later.

To create a new JSR portlet project, follow these steps:

  1. Click

    File | New | Project.

    In the New Project Wizard, expand the Portal folder and select Portlet Project. Click Next.

  2. Click Next. The New Portal Project wizard opens.

  3. Provide values, as appropriate, for the following fields:

    Project name

    Type a name for the new portlet project.

    Project contents

    Set the location in the file system where the project will be created. Accept the default workspace, or change the file system location by using Browse.

    Target runtime

    Select the appropriate server version for your portlet project.

    Add module to an EAR project

    Select this check box if you intend to deploy the portlet.

    EAR project

    Type the name of an enterprise application project (EAR project) that the portlet project will be associated with for purposes of deployment. The information that is used to deploy the portlet project to WebSphere Portal in the test environment will be added in this project. All portlet applications associated with a single EAR project will run in a single session at the test environment. You can separate portlet applications into multiple EAR projects. Use the same EAR project for other projects that are related.

    Portlet API

    Select JSR 168 Portlet or JSR 286 Portlet.

    Create a portlet

    Select this check box to create a portlet for this project. Specify a name for the portlet and its type.

    Empty portlet

    Select to creates a portlet application that extends the GenericPortlet class, with minimum code included.

    Basic portlet

    Creates a basic portlet application that contains a portlet class that extends the GenericPortlet class, sample JSP files that are used in rendering the portlet, and a sample Java bean for holding session data. In addition to these basic resources, you can add sample code to the project for functions that are often used by portlet applications as you specify additional wizard options.

    Faces portlet

    Creates a Java Server Faces (JSF) portlet application.

    Struts portlet

    Creates a Struts portlet application.

    Note: Struts portlet application is not supported in JSR 286.

    Show advanced options

    Select

    Show advanced options to access facet and runtime options within this wizard.

    If you want to accept the defaults associated with the portlet project, click Next and then Finish. If you want to customize the project options, click Next and continue through the wizard.

  4. In the Portlet Settings page, define the following items:

    Content types and modes

    Specify the content type and its modes.

    • The HTML, which must be supported by all portlet application, is always generated by the wizard.

    • For projects targeting WebSphere Portal, the wizard will generate a portlet project using an IBM® extension: wps.markup, which will enable the portlet further markup distinctions that extend the pure MIME type. For more information about this IBM extension, refer to Developing portlets using JSR and WebSphere Portal .

    • The view mode is always selected.

    Code generation options

    Select the Generate a custom portlet class box if you intend to create a portlet class that performs custom handling of actions or rendering.

    • Package prefix: defaults to a combination of the default package naming preference plus the project name.

    • Class prefix: defaults to a combination of the portlet-name suffixed by "Portlet" suffix.

    • Super class: a base class for the portlet class being generated.

    Locale specific information

    Choose the default, or click

    Add to create a new locale.

    Note: If you are creating an Empty portlet project, click Finish. The wizard will create an empty project container primed with the appropriate folder structure, along with a deployment descriptor. To complete the portlet application, you need to customize the new empty portlet project.

  5. Click Next.

  6. In the Action and Preferences page, define the action and preferences handling of the portlet. These options are for Basic portlet projects. Refer to topics on Java Server Faces and Struts portlet projects for wizard options specific to those portlet types.

    Add action listener to the portlet to handle action requests

    Select this option to implement the processAction method for handling action requests. The action request handler is invoked when an HTTP request associated with a portlet action is received.

    Add form sample (available only when Add action listener is selected)

    Select this option to add a form sample in the view panel.

    Add preferences handling to portlet to display and edit preferences

    Select this option to show preferences on the view panel. It also provides an edit panel to modify portlet preferences. Portlet preferences are stored as persistent data and can be used for personalized preferences.

    Add preferences validator (Only if "Add preferences handling" is selected)

    This option adds a preferences validator class to validate preferences.

  7. Click Next.

  8. In the

    Advanced Settings page, you can specify options for credential vault handling, business process integration, add a cache key helper, and Web 2.0.

    A. Add credential vault handling

    Select this option to support credential vault handling. WebSphere Portal supports the use of a credential vault where users and administrators can safely store credentials for authentication. For more information on the credential vault handling, refer to "Portlet authentication" in the WebSphere Portal Information Center. Portlets written to extract the user's credentials from the vault can hide the login challenge from the user. Select one of the following types of vault slots:

    Use portlet private credential vault slot

    A portlet private slot stores user credentials that are not shared among portlets.

    Use shared credential vault slot

    A shared slot stores user credentials that are shared among the user's portlets.

    Use administrative credential vault slot

    An administrative slot enables each user to store their confidential information for accessing administrator-defined resources (for example, Lotus Notes®).

    Use system credential vault slot

    A system slot stores system credentials where the actual confidential information is shared among all users and portlets. System credentials are stored by the administrator. Portlets can only retrieve the credentials from the system slot.

    Slot name

    Defines the name of the credential vault slot to store and retrieve user credentials.

    Show password

    Select this option to display on-screen in the view mode.

    B. Enable business process integration

    To enable this integration, select the following check boxes:

    Add task processing

    Select this option to enable the portlet to initiate a new business process task.

    Add process initiation

    Select this option to enable the portlet to initiate a new business process

    C. Add cache key helper

    Select this option to copy the cache key helper class. Click Next.

    D. Web 2.0

    • Select the

      AJAX Proxy check box to enable AJAX proxy support for both new and existing portlet projects

    • Client-side support is enabled automatically when you create a new portlet project.

  9. Click Finish to create the new portlet project.

  10. Click

    Yes if the

    Open Associated Perspective dialog box is displayed. If you do not want to be prompted for this every time, select the

    Remember my decision check box.

Some of the portlet configuration parameters are assigned default values. To reconfigure these values edit the portlet deployment descriptor. You can add additional portlets and portlet JSP files to a portlet project.

 

Related concepts

Portlet APIs

Creating portlets and portlet projects

Working with portlet deployment descriptors

Markup languages

 

Related tasks

Creating portlet projects (IBM portlet API)

Customizing JSR portlets

Creating portlets

Creating portlet JSP files

Customizing empty JSR portlet projects

Creating Faces portlet projects

Creating Struts portlet projects