Creating, adding, removing, or editing portlets
Creating a portlet
You can create a new portlet, add an existing portlet to the portlet deployment descriptor, or remove the selected portlet from the portlet deployment descriptor.
To create a new portlet,...
- Open the portlet deployment descriptor editor by double-clicking on it in the Project Explorer view.
- Click the New button to open a wizard.
- Specify the folder where the new portlet will be placed, the package that the portlet will belong to (the portlet is added into a default package if you do not specify one), a class name for the portlet, and the superclass for the portlet. You should specify GenericPortlet, or any class that has GenericPortlet in its hierarchy, as its superclass.
- Supply portlet class modifier and interface information. Classes cannot be both abstract and final. Specify method stubs to be generated. Click the Add button to open the Interfaces Selection dialog. Here you can specify additional interfaces for the portlet to implement. Using the appropriate check boxes, select method stubs to be created in the portlet file. The Inherited abstract methods and Constructors from superclass options add stubs for inherited abstract methods and superclass constructors that must be implemented (unless you intend to create an abstract portlet).
Adding an existing portlet
To add an existing portlet, follow these steps:
- Click the Add button to open a wizard.
- Select a class and package name of a portlet.
Configuring a portlet
To configure a portlet, first select it from the Portlets list box and specify the following values:
Table 1. Portlet class Property Name Description Portlet class The canonical name of the portlet selected in the Portlets list box. Select the Browse button to open the Select Portlet dialog and create a new mapping in the deployment descriptor. Used in the <portlet-class> node.
Table 2. Localization of deployment descriptor values Property Name Description Language The locale information used in the xml:lang attribute to localize the Display name and the Description. The default value for the xml:lang attribute is English (en). Used in the xml:lang attribute of <display-name> and <description> in <portlet>. Display name An administrative name used to identify the portlet. It is only shown in GUI tools. Used in <display-name> in <portlet>. Description A descriptive text about the portlet. This text is not displayed to end users. Used in <description> in <portlet>.
Table 3. Language specific portlet information Property Name Description Resource Bundle To provide language specific portlet information, like title and keywords, resource bundles are used. Set the fully qualified class name of the resource bundle. Used in <resource-bundle>. Supported Locales Declare locales the portlet supports at run-time. Used in <supported-locale>, and to locate the resource bundle file for each locale. Portlet Info Specify the following portlet information for each supported locale. Select a supported locale above and specify the portlet information for the selected locale. The specified information will be saved in resource bundle files.
- Title
- The title that should be displayed in the title bar of this portlet. Only one title per locale is allowed. Note that this title may be overridden by the portal or programmatically by the portlet. Used in <title> in <portlet-info> for the default locale, and used in javax.portlet.title in the language specific resource bundle file for other locales.
- Short title
- A short version of the title that may be used for devices with limited display capabilities. Only one short title per locale is allowed. Used in <short-title> in <portlet-info> for the default locale and used in javax.portlet.short-title in the language specific resource bundle file for other locales.
- Keywords
- Keywords that describe the functionality of the portlet. Portals that allow users to search for portlets based on keywords may use these keywords. Multiple keywords per locale are allowed, but must be separated by a comma (,). Used in <keywords> in <portlet-info> for the default locale and used in javax.portlet.keywords in the language specific resource bundle file for other locales.
Removing a portlet
In the Portlet Deployment Descriptor, highlight the portlet you want to remove, then click Remove.
Related concepts
Portlet APIs
Creating portlets and portlet projects
Working with portlet deployment descriptors
Related tasks
Configuring JSR 168 portlets
Defining portlet security constraints
Defining custom portlet modes
Defining custom window states
Defining user attributes
Related reference
References