+

Search Tips   |   Advanced Search

Advanced URL generation for data exchange

For data exchange, HCL WebSphere Portal supports cross-portlet links

Cross-portlet links work for both IBM and JSR portlets. They use the state API to generate a URL that points to a render parameter of a specific portlet. With the advanced URL generation APIs for portlets, we can have a portlet create a link that points to another portlet, possibly even on a different page, and pass data to that portlet. If it is at all possible, use the publish/subscribe methods. Use explicit cross-portlet links only where other techniques are not applicable. For example, this can be for communication between IBM and JSR portlets.

For details, refer to the documentation about the portalRenderURL tag and the PortalURLGenerationService. Such links can also be created from a theme JSP that uses the portal URL generation tag.

For advanced use cases that require more control over the generated URLs, we can also use the portal state API.

If the pure render parameter approach is not applicable, generating URLs and transporting the data to be communicated is suggested. There are three options available: JSP tag URL generation, PortalURLGenerationService, and state API-based URL generation.

    JSP tag URL generation
    This approach is only supported for JSR portlets and allows the user to generate URLS that transport information from within portlet JSPs. See JSP tags for standard portlets in the related links.

    PortalURLGenerationService based URL generation
    Use this service to generate render URLs to other portlets. See Interface PortalURLGenerationService in the related links. This option might be available only if specific portlets are targeted and if render URLs need to be created for the target portlets in question. See Leveraging HCL WebSphere Portal V6 programming model: Part 2. Advanced URL generation in themes and portlets in the related links.

    State API-based link generation
    Generating state API-based URLs allows the transfer of data to portlets developed using the JSR168 API or JSR286 API. State API-based link generation is the most powerful way of modifying the navigational state and thus share information between portlets. In addition to the portlet state aspects such as portlet mode and window state, state API-based link generation also enables us to set private or public render parameters for one or multiple portlets. See Leveraging HCL WebSphere Portal V6 programming model: Part 2. Advanced URL generation in themes and portlets.

  • To set private render parameters for a given portlet, request the PortletAccessorController from the PortletAccessorFactory. See Interface PortletAccessorController in the related links.

  • To modify shared state information such as public render parameters for JSR286 portlets, we can also request the SharedStateAccessorController from the PortletAccessorFactory. See Interface SharedStateAccessorController in the related links.

  • So far, the URLs being generated modify navigational state information only and do not carry any action semantic, which is necessary to modify the persistent backend state. PortletTargetAccessorController is available from the PortletAccessorFactory and enables the targeting of a specific portlet's processAction method. PortletTargetAccessorController triggers a processAction on the specific target portlet the generated URL points to.

  • Standard portlets provide powerful publish and subscribe mechanisms for exchanging information through an action phase invoked between portlets. During the invocation, portlets can exchange complex data and trigger portlet activity such as updates to back-end systems.


Parent Portlet communication

Related concepts:

Public render parameters

Related reference:

JSP tags for standard portlets


Related information


Interface PortalURLGenerationService
Leveraging HCL WebSphere Portal V6 programming model: Part 2. Advanced URL generation in themes and portlets
Interface PortletAccessorController
Interface SharedStateAccessorController
http://www-128.ibm.com/developerworks/websphere/library/techarticles/0612_behl/0612_behl.html
http://www-128.ibm.com/developerworks/websphere/library/techarticles/0603_behl/0603_behl.html