Creating portlets and portlet projects

A portlet project, like a web project, is a J2EE web application. It is similar to a web project in that a web.xml file is maintained for it. The main difference between a portlet project and a web project is that the portlet project has an extra deployment descriptor, portlet.xml file, in the WEB-INF directory.

Portlet projects

There are three types of portlet projects.
  • Portlet Project (JSR 286): A portlet project that contains resources for portlet applications that use the JSR 286 portlet API. The JSR 286 portlet API is supported by WebSphere® Portal and WebSphere Application Server.
  • Portlet Project (JSR 168): A portlet project that contains resources for portlet applications that use the JSR 168 portlet API. The JSR 168 portlet API is supported by WebSphere Portal and WebSphere Application Server.
  • Portlet Project (IBM®): A portlet project that contains resources for portlet applications that use the IBM portlet API.
A project facet is a specific unit of functionality that you can add to a project when that functionality is required. When a project facet is added to a project, it can add natures, builders, classpath entries, and resources to a project, depending on the characteristics of the particular project. Web 2.0 facets define the characteristics of your Web 2.0 enabled portlet. The Web 2.0 facets specify the requirements and constraints that apply to your portlet project. To create a Web 2.0 enabled portlet project, use the New Portlet Project wizard and apply the Web 2.0 project facets. Web 2.0 enables support for:

Portlet Type

You can select one of the following portlet types:

  • Empty portlet: Creates a portlet application and a portlet entry on the portlet deployment descriptor. A skeleton portlet class is also created. To complete the portlet application, you need to update the portlet class.
  • Basic portlet: Creates a portlet application that extends a portlet class: the Portlet Adapter class of the IBM portlet API, or the GenericPortlet class of the JSR 168 portlet API. This portlet type contains the portlet class, sample JSP files that are used in rendering the portlet, and a sample Java™ bean.
    Several programming patterns are used in the portlet, including:
    • Forms handling
    • Storage of data items in the Portlet Session or Portlet Request
    • Use of beans
    • Tag library
    In addition, you can optionally add the following programming patterns using the wizard:
    • Action handling
    • Message handling
    • Storage of Portlet Data or Portlet Preferences
    • Single sign-on support
    • Multiple markups
    • Multiple portlet modes
  • Faces portlet: Faces (JavaServer Faces) portlets are available for JSR 286, JSR 168, and IBM portlet API. Faces portlets only support J2EE 1.3 or higher, and can be deployed to WebSphere Application Server.
Table 1. Supported portlet types - Cross mark (X) represents the supported portlet project
  JSR 286 API JSR 168 API IBM portlet API
Portlet Type Faces portlet Basic portlet Empty portlet Faces portlet Basic portlet Empty portlet Basic portlet Empty portlet
WebSphere Portal V8.0 X X X X X X X X
WebSphere Portal V8.5 X X X X X X X X
WebSphere Portal V8.0 on WebSphere Application Server V8.5 X X X X X X X X
WebSphere Application Server V8.0 X - X X - X - -
WebSphere Application Server V8.5 X - X X - X - -
WebSphere Application Server Liberty Profile - - X X - X - -
  • Asterisk mark (*) represents portlet project supported without JSR 286 events
  • Double asterisk marks (**) represents portlet project supported without WebSphere Portal specific features

Feedback