includePortlet

Task

This element includes a portlet into an HTML page. If required, you can use an instance identifier to generate different instances of the portlet. If, for example, you would like to include a voting portlet, one instance is sufficient and there is no need to specify the instance name even if the portlet is embedded into several or all the pages of your site. However, if the portlet is used to let users rate individual pages, an individual instance name must be specified for each page. In this case, the path of the page might be used as the instance name because it is unique. The path can be determined by means of an @ reference (see the example below).

Syntax

<npspm includePortlet="urlPath" instance="instanceId" language="lang" withBorder="borderFlag" />

If the portlet to be included is part of the same web application as the Portal Manager, urlPath is the name of the portlet or the alias path that has been specified as portletPathMapping in the pm.xml file. This name must not be /. However, if the portlet is part of a different web application, urlPath is the URL path of the portlet relative to the directory containing the web applications (normally webapps).

By means of the instanceId attribute an instance identifier can be specified. This makes it possible to use the portlet serveral times on the same website or even on the same page. The identifiers may consist of any characters.

The language in which a portlet displays itself normally corresponds to the language the user has specified in his browser settings. The language parameter serves to override this setting.

The value of language, lang, is a code such as en or fr standing for one of the languages supported by the portlet. These languages are defined in the portlet.xml file which can be found in the WEB-INF directory of the portlet web application.

As borderFlag, the value of withBorder, true or false can be specified to determine whether the portlet is to be displayed including a frame and a title bar with buttons.

Example

<npspm includePortlet="/myportlets/ranking" instance="@visiblePath" withBorder="false" />