Tool support for event and public assignment parameters for portals and portlet programs
The new features introduced in Java portlet Specification 2.0, based on JSR 286, support collaboration between portlets. Events and public assignment variables are the two mechanisms by which portlets can communicate with each other. After a brief introduction to some key concepts, this article will show you how to use the Portal Toolkit in Ibm®rational®application Developer V7.5 to create an example of a JSR 286 base portlet. In this process, it explains how Portal Toolkit accelerates the entire process to upgrade these features.
Key Concepts
This article first introduces the key concepts and then uses the sample Portlet program to illustrate these concepts.
Event
The Java™specification Request (JSR) 286 Specification Version 2 makes it possible for portlets to send and receive events. Events enable Portlets to communicate with each other. Ibm®rational®application Developer V7.5 provides a series of tools to define events, activate Portlets, and use events to pass data between them. A portlet can handle both sides of the communication:
Sending events to other Portlets
Receive and process events from other Portlets
Properties of the event
Each event must have a name and possibly other attributes:
Name: Events unique names. The event name must be a complete QName, as in the name defined in the XML specification, consisting of a name area (for example, http://www.ibm.com) and the region (for example, SampleEvent). You can use the same name area for multiple events, just declare it as the default name area, and then specify only the region for each event.
Description: (optional) A description of the event.
Value type: (optional) The Jazz class name of the value that is passed along with the event.
Alias: (optional) event name area-specific name.
Follow the steps below to create a portlet program that integrates events and public assignment variables to communicate between portlets:
Create a JSR 286 portlet project and portlets.
Create an event definition in the Portlet Deployment descriptor (PDD).
Adds an event as a published or handled event that is supported by the portlet.
Edit the procedure behavior or event code in the Portlet class to publish or handle the event.
Add a public assignment variable.
Publish the Portlet project to the server.
Bring the portlets together.
These tasks can be greatly simplified by using the tools provided by the Rational application Developer V7.5.
Public assignment variables
The JSR 286 specification provides another mechanism to support collaboration between portlets: Public assignment variables (view resources to find more information about it). These parameters provide a way to share request parameters between portlets.
Properties of public assignment variables
Each variable must have a name, or there may be other attributes:
Name: (required) parameter unique names, either a string or a name space-specific name. Select the default namespace or specify a different. The local string you entered as the event name is added to the namespace.
Identifier: (required) The string used in the Portlet code to refer to the assignment variable.
Description: (optional) A description of the assignment variable.
Alias: (optional) The name within the namespace area of the parameter.