Aggregation tag library attributes
The aggregation tag library is used to aggregate multiple portlets on one page.
Supported arguments include:
- init
- This tag initializes the portlet framework and has to be used in the beginning of the JSP. All other tags described in this section are only valid in the body of this tag, therefore the init tag usually encloses the whole body of a JSP. In case the current URL contains an action flag the action method of the corresponding portlet is called. The state and insert tags are sub-tags of the init tag.
The init tag has the following attributes:
- portletURLPrefix = "<any string>"
This URL defines the prefix used for PortletURLs. Portlet URLs are created either by the state tag or within a portlet's render method, which is called using the insert tag. This is a required attribute.
- portletURLSuffix = "<any string>"
This URL defines the suffix used for PortletURLs. Portlet URLs are created either by the state tag or within a portlet's render method, which is called using the insert tag. This is attribute optional.
- portletURLQueryParams = "<any string>"
This URL defines the query parameters used for PortletURLs. Portlet URLs are created either by the state tag or within a portlet's render method, which is called using the insert tag. This is attribute optional.
- scope, portlet
- The scope tag and portlet tag are used to provide information necessary when a portlet application is installed under a multiple part context root, for example, /context1/context2. These tags also define which portlet windows should participate in portlet coordination via public render parameters, and add a render parameter to the newly created URL.
The urlParam tag has the following attributes:
- context = "/<context1>/<context2>"
Context root of the portlet application in which the portlet is deployed. This attribute is required.
- portletname = "<portlet-name>"
Portlet-name. This attribute is required.
- windowId = "<any string>"
Defines the window ID for the concrete portlet instance. This attribute is required.
The following is an example of how to use the scope and portlet tags:
<%@ taglib uri="http://ibm.com/portlet/aggregation" prefix="portlet" %> <portlet:scope> <portlet:portlet context="/myportletcontext1/myportletcontext2" portletname="MyPortlet" windowId="sample"/> </portlet:scope> <portlet:init portletURLPrefix="/myportalcontext/ "> …. </portlet:init>
- state
- The state tag creates a URL pointing to the given portlet using the given state. We can place this URL either into a variable specified by the var attribute or we can write it directly to the output stream. This tag is useful to create URLs for HTML buttons, images, and other items such that when the URL is invoked, the state changes defined in the URL are applied to the given portlet.
The state tag has the following attributes:
- url = "<context>/<portlet-name>"
Identifies the portlet for this tag using the context and portlet-name to address the portlet. This attribute is required.
- windowId = "<any string>"
Defines the window ID for the portlet URL created by this tag. This is attribute optional.
- var = "<any string>"
If defined the URL is written into a variable with the given scope and name, not to the output stream. This is attribute optional.
- scope = "page|request|session|application"
This attribute is only valid if the var attribute is specified. If defined, the URL is not written to the output stream but a variable is created in the given scope with the given name. The default is page. This is attribute optional.
- portletMode = "view|help|edit|<custom>"
This attribute sets the portlet mode.
- portletWindowState = "maximized|minimized|normal|<custom>"
This attribute sets the window state.
- action = "true/false"
This attribute defines whether this is an action URL. This is attribute optional. The default is false.
- urlParam
- Adds a render parameter to the newly created URL.
The urlParam tag has the following attributes:
- name = "<any string>"
Indicates the name of the parameter. This is attribute required.
- value = "<any string>"
Indicates the value of the parameter. This is attribute required.
- insert
- This tag calls the render method of the portlet and retrieves the content as well as the title. We can optionally place the content and title of the specified portlet into variables using the contentVar and titleVar attributes.
The insert tag has the following attributes:
- url = "<context>/<portlet-name>" (mandatory) Identifies the portlet for this tag using the context and portlet-name to address the portlet
This is attribute required.
- windowId = "<any string>"
Defines the window ID of the portlet. This is attribute optional.
- contentVar = "<any string>"
If defined, the portlet's content is not written to the output stream but written into a variable with the given scope and name. This is attribute optional.
- contentScope = "page|request|session|application"
This attribute is only valid if the contentVar tag is used. If defined, the portlet's content is written into a variable with the given scope and name, not to the output stream. The default is page. This is attribute optional.
- titleVar = "<any string>"
If defined the portlet's title is written into a variable with the given scope and name. If it is not defined, the title is ignored and not written to the output stream. This is attribute optional.
- titleScope = "page|request|session|application"
This attribute is only valid if titleVar tag is used. If defined, the portlet's title is written into a variable with the given scope and name, not to the output stream. The default is page. This is attribute optional.
Manage portlets Portlet aggregation using JavaServer Pages Example: Using the portlet aggregation tag library