Creating portlet projects (IBM portlet API)

You can create and maintain the resources for your portlet applications using the IBM® portlet API in portlet projects. Portlet projects can be added to a new or existing enterprise application project.

To create a new portlet project, follow these steps:

  1. Click

    File | New | Project, ,

  2. In the New Project wizard, click

    Portal | Portlet Project, and then click Next. The

    New Portlet Project wizard opens.

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

    Project name

    Name for the new portlet project.

    Project contents

    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 WebSphere® Portal 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) to be associated with the portlet project for purposes of deployment. The information 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 on a single session in the test environment. You may separate portlet applications among multiple EAR projects. Use the same EAR project for other projects that are related.

    Portlet API

    Select the IBM portlet API.

    Create a portlet

    Clear this check box only if you do not want to create a portlet at this time. New portlets can be added to a project after it is created. Specify a name for the portlet and a technology:

    Empty portlet

    Creates a portlet application that extends the PortletAdapter class, with minimum code included. Refer to Customizing empty portlet projects using IBM portlet API if you want to create a new portlet application from scratch.

    Basic portlet

    Creates a basic portlet application that extends the PortletAdapter class. This is a complete application with a concrete portlet and a concrete portlet application. It contains a portlet class that extends the PortletAdapter class, sample Java™ Server Pags (JSP) files that are used in rendering the portlet, and a sample Java bean. 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 Faces portlet application. Refer to Creating Faces portlet projects.

    Struts portlet

    Creates a Struts portlet application. Refer to Creating Struts portlet projects.

    Show advanced options

    Mark this check box to access facet and runtime options in this wizard.

    If you want accept the defaults associated with an IBM portlet project, click Next, then Finish. If you prefer to customize more project options, click Next and continue with 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 markup, which must be supported by all portlet application, is always generated by the wizard.

    • The view mode must be selected.

    Code generation options

    Check 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: a combination of the portlet-name with "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 and then click Next.

    Note: If you are creating an Empty portlet project, your only option is to 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, customize the new empty portlet project. See Customizing empty portlet projects using IBM portlet API.

  5. In the Events handling page, define the following: These options are for Basic portlet projects, refer to portlet project topics for Faces and Struts for details that pertain to those projects.

    Add action listener to the portlet to handle action requests

    This option implements the actionPerformed() method for handling action requests. The action request handler is invoked when an HTTP request associated with a portlet action is received.

    Add JSP form sample (Available only when "Add action listener" is selected)

    This option adds a form sample in the view panel, which will submit some values for the portlet to process in the "actionPerformed()" method.

    Add message listener to portlet to handle portal message events

    This causes the generated portlet class to log action events (ActionEvent) and messaging events (MessageEvent) and to report the events in the portlet's view mode.

    Add message sender portlet sample (Only if "Add message listener" is selected)

    This option generates a sample portlet that initiates portlet messaging events for the main portlet to process in its messageReceived() method.

    Add event log viewer to portlet user interface

    This causes the generated portlet class to log action events (ActionEvent) and messaging events (MessageEvent) and to report the events in the portlet's view mode.

    Add edit panel to change maximum event count (Only if "event log viewer" is selected)

    This option sets a limit to the number of events that are being logged by the portlet. Older event entries are abandoned as new events come in.

  6. Click Next.

  7. In the Advanced Settings page, you can specify options for credential vault handling and business process integration.

    Add credential vault handling

    Selecting this option enables credential vault handling. WebSphere Portal supports the use of a credential vault in which users and administrators can safely store credentials for authentication. Portlets written to extract the users' credentials from the vault can hide the login challenge from the user. Select one of the following types of vault slots. You can add sample code to support credential vault handling in the Single Sign-On page. This allows users and administrators to safely store credentials for authentication. For more information on the credential vault handling, refer to "Portlet authentication" in the WebSphere Portal Information Center.

    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 allows 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.

    Slot name

    This field defines the name of the credential vault slot to store and retrieve user credentials.

    Show password

    Selecting this check box to display the password, in the screen, when in the edit or configuration mode.

  8. Click Finish to create the new portlet project.

  9. Click

    Yes if the

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

    Remember my decision box.

  10. Some of the portlet configuration parameters are assigned default values.

To reconfigure these values by editing the portlet deployment descriptor, refer to Customizing IBM API portlets

Depending on your selection, sample portlets that contain JSP files are generated. To add additional portlets to a portlet project, refer to Creating portlets

To add portlet JSP files, refer to Creating portlet JSP files.

Refer to the following topics for additional details about creating specialized portlets:

 

Related concepts

Portlet APIs

Creating portlets and portlet projects

Working with portlet deployment descriptors

Markup languages

Developing cooperative portlets

 

Related tasks

Creating portlet projects

Customizing IBM API portlets

Creating portlets

Customizing empty portlet projects using IBM portlet API