+

Search Tips   |   Advanced Search


Deployment descriptors

Each portlet application requires two deployment descriptors:

The following topics describe the deployment descriptors of a portlet application:


Web application deployment descriptor

This section describes the required elements of the web.xml for IBM and standard portlets. For more information about the Web application deployment descriptor, see the Java Servlet Specification Version 2.3.

Web application descriptor for standard portlets

As described in the Java Portlet Specification, a portlet application is an extended Web application and therefore has a servlet context.

The portlet context leverages most of its functionality from the servlet context of the portlet application. Since the web.xml is a mandatory item in a J2EE Web ARchive, you should make sure your portlet application includes a web.xml in its WAR file that conforms to Version 2.3 or a later version of the Java Servlet Specification. This ensures that the portlet application is compatible with other portal server implementations as well as WebSphere Portal. The web.xml should contain, at a minimum, the <web-app/> and <display-name/> elements.

You can also include context-wide parameters using the <init-param> element. Refer to the Java Servlet Specification Version for more information about the structure of the Web application deployment descriptor.

IBM Web application descriptor

As with other servlets following the J2EE model, IBM portlets are packaged as WAR or EAR files with a Web application deployment descriptor (web.xml). This descriptor defines each portlet as a servlet within the Web application, including unique identifiers for each portlet, the portlet class, and initialization parameters.

The definition of the servlets in the web.xml must be in the same order as the definition of portlets in the portlet.xml.

The servlet identifier must be referenced by the portlet deployment descriptor, using the href attribute of the <portlet> tag. As shown in the following table, the href attribute indicates the path of the Web application descriptor in the WAR file appended by the servlet ID as the anchor.

portlet.xml web.xml

  <portlet id="Portlet_1"
           href="WEB-INF/web.xml#Servlet_1">
    <portlet-name>Mail</portlet-name>
    ...
  </portlet>

  <servlet
    id="Servlet_1">
    <servlet-name>MailPortlet</servlet-name>
    ...
  </servlet>

  <portlet id="Portlet_2"
           href="WEB-INF/web.xml#Servlet_2">
    <portlet-name>Calendar</portlet-name>
    ...
  </portlet>

  <servlet
    id="Servlet_2">
    <servlet-name>CalendarPortlet</servlet-name>
    ...
  </servlet>


Portlet deployment descriptor

This section describes the portlet.xml for standard and IBM portlets.

Guidelines for portlet application identifiers

The identifiers of portlet applications must identify them unambiguously in the area of their usage, which could be worldwide. The same is true for concrete portlet applications for IBM portlets. To make this possible, follow these guidelines.

  • Include the portlet's namespace in the identifier, using the same format that is used for the Java packages

  • Add some portlet application specific description

  • Add some arbitrary characters to guarantee uniqueness within the namespace, for example:

     com.ibm.wps.samplet.mail.4969
    

  • For IBM portlets, add suffixes for the corresponding concrete portlet applications, for example:

     com.ibm.wps.samplet.mail.4969.1
    

Portlet identifiers must be unique within the application.

Standard portlet deployment descriptor

In the Java Portlet Specification, the portlet descriptor is in the format of an XML Schema. Since the portlet is not a servlet, the portlet descriptor does not reference a corresponding servlet ID in the web.xml. The top level element is the <portlet-app/> which contains one or more <portlet/> definitions. Portlet specific initialization parameters are stored in the portlet.xml by using the <init-param/> element and are obtained from the PortletConfig object provided during initialization.

IBM portlet deployment descriptor

The structure of the IBM portlet deployment descriptor is defined by a DTD, which is located at wps.war/dtd/portlet_1.1.dtd. For IBM portlets, each concrete portlet definition indicates its parent portlet using the href attribute of the <concrete-portlet> tag. As shown in the following table, the href attribute indicates the portlet ID as an anchor.

Portlet tag Concrete portlet tag

  <portlet id="Portlet_1"
           href="WEB-INF/web.xml#Servlet_1">
    <portlet-name>Mail</portlet-name>
    ...
  </portlet>

  <concrete-portlet href="#Portlet_1">
    <portlet-name>Mail Box</portlet-name>
    ...
  </concrete-portlet>

  <portlet id="Portlet_2"
           href="WEB-INF/web.xml#Servlet_2">
    <portlet-name>Calendar</portlet-name>
    ...
  </portlet>

  <concrete-portlet href="#Portlet_2">
    <portlet-name>Group calendar</portlet-name>
    ...
  </concrete-portlet>


Reserved parameter names

This section describes parameters that can be set for portlets. There are two types of parameters:

Configuration parameters

These are parameters for a portlet that can be changed only by an administrator. They are defined in the file portlet.xml using either the <config-param/> elements (for IBM portlets) or the <preferences/> element marked as read-only (for standard portlets).

Initialization parameters

These parameters are set during deployment. For standard portlets, they are set by the <init-param/> element in the portlet.xml.

For IBM portlets, they are set by the <init-param/> element in the web.xml.

The following parameters can be set as configuration parameters in IBM portlets or initialization parameters in standard portlets:

redirect.action.without.session = (false)

Set this parameter to true to enforce a redirect after an action on anonymous pages for this portlet.

wps.markup

This is an initialization parameter in standard portlets to define the supported markup types for the portlet. Use it to differentiate between markup types, such as HTML and cHTML, that use the same MIME type.

com.ibm.portal.automaximize

Set this parameter to true to automatically maximize the portlet when the user switches from view mode to any of the other supported modes. The default is false.

wps.multiple.action.execution

Set this parameter to true to enable the user to execute the same action URL several times.

The following parameters can be set as configuration parameters in IBM portlets or read-only preferences in standard portlets:

parallel = (false)

When you set this parameter to true, you indicate that the portlet can be rendered in parallel with other portlets on the page. The default is false.

com.ibm.portal.pagecontext.enable = (false)

When you set this parameter to true, you indicate that the portlet can retrieve task properties. This parameter is used by task processing portlets. The default is false.


Container run time options

The portal defines container run time options which can be utilized by portlets that conform to the Java Portlet Specification 2.0 (JSR286). You set these parameters by using the <container-runtime-option> element in the portlet.xml.

com.ibm.portal.public.session

Set this parameter to true to allow session creation for anonymous users for this particular portlet. Example:

<container-runtime-option>
   <name>com.ibm.portal.public.session</name>
   <value>true</value>
</container-runtime-option>


Parent topic:

Portlet development reference


Related concepts


Markup guidelines
Accessing the portlet session on the anonymous page
Handling and visibility of request parameters in portlets
Application extension registry
Portlet concepts
IBM Portlet API
Understand the basics


Related reference


IBM portlet DTD tag reference
JSP tags for standard portlets
JSP tags for IBM portlets
Drag and drop JSP tags
Detailed descriptions of the Struts WML tags


Related information


Java Portlet Specification JSR 168 (http://jcp.org/en/jsr/detail?id=168)
Java Portlet Specification JSR 286 (http://jcp.org/en/jsr/detail?id=286)