Show TOC Start of Content Area

Background documentation Developing Portlets  Locate the document in its SAP Library structure

Portlets are Web components that generate dynamic content. The portlet container contains portlets, provides them with the required runtime environment, and manages their life cycle. Portlets rely on the portal infrastructure to access user profile information and to store its portlet preferences into persistent storage.

This graphic is explained in the accompanying text

Elements of a Portal Page

 

Portlets generate markup fragments, not complete documents. The portal adds titles and decorations to the content received and aggregates it to form a complete portal page. Portlets have access to user profile information and can store persistent and customization data. For more information, see Portlet Life Cycle.

There are two ways to develop a new portlet. You can either implement the javax.portlet.Portlet interface or extend the javax.portlet.GenericPortlet class that already implements the portlet interface. For more information, see Implementing the Portlet Interface and Extending the Generic Portlet.

Portlet Modes and Window States

The portlet container manages the portlet mode and window state for each portlet. A portlet’s mode specifies the function it currently performs. Portlets generate content depending on the function they are performing.

The window state of a portlet is the amount of portal page that is allocated to the content generated by the portlet.

Portlet Preferences

Portlets can also generate content depending on the user accessing them. The portlet container stores customization data as a persistent set of name-value pairs, that is, portlet preferences, in the portlet deployment descriptor. For more information, see Portlet Preferences.

Portlet Sessions

Portlets, servlets, and JSPs within the same portlet application share the same HTTP session. For portlets within the same portlet application, each portlet request is generated as a result of a group of requests originating from the portal to complete a single client request, and acquires the same portlet session. For more information, see Portlet Sessions.

Localization

The portlet specification provides localization on two levels: deployment descriptor and portlet. On the deployment descriptor level, all settings intended to be viewed or changed by the Web server administrator (portlet description, init parameters, display name, and so on) consist of an xml:lang attribute, like the Servlet 2.4 deployment descriptor. The xml:lang tag provides the same tag with descriptions in different languages, for example, a display name in English, German, and so on.

On the portlet level, the specification sets a resource bundle class in the deployment descriptor that contains the portlet title's localized versions, the short title for graphically restricted devices, and keywords describing the portlets' functions. In addition to this information, the specification also recommends a notation for localizing the preference attribute display names, values, and descriptions. The portlet can access the resource bundle using the getResourceBundle()method of the PortletContext.

Packaging and Deployment

Portlets, servlets, JSPs, and static Web resources are packaged in an extended Web application called a portlet application. Portlet applications require an additional deployment descriptor, portlet.xml. In terms of session handling and life cycle, portlets are completely associated with the containing Web application. For more information, see Packaging and Deployment Descriptor.

End of Content Area