With the Cooperative Portlet Source and the Cooperative Portlet Target builders, you create portlets that can interact with each other to share information. One or more target portlets on a portal page can automatically react to changes from a source portlet when the source portlet triggers an event.
The following are the high-level steps required to implement these types of Portlets:
- Create a target model using the Cooperative Portlet Target builder, which will receive the event from the source. Add an Event Handler builder to this model to process the event.
- Create a source model using the Cooperative Portlet Source builder, which will trigger an event that is to be received by the target portlet.
- Publish or export the project and add the source and target portlet to a portal.
- Place the portlets on a portal page, and use the Portlet Wiring tool to connect the source portlet to the target.
In most common applications of this builder use these inputs to create portlets that can communicate with one another: See the builder input help for a complete description.
WSRP and Portlet Communication
- Name - Enter a name for this builder call.
- Type - Select the Cooperative Portlet type. Typically Property Broker Link or Property Broker Action.
- Output Definitions
- Name - Enter the name of the output that will be passed to the target. For example, OrderID. This input is required. For JSR 286 portlets this must match the Input Name specified in the target builder.
- Output Type Name - Enter the XML Schema Datatype name for the output. This must match the Input Type Name specified in the target builder. This is not used for JSR 286 portlets. Example: OrderIDType
- Value - Enter the value to be passed as an input to the target event.
If you are using WSRP add the bowstreet.portlet.event.disableActiveWireCheck=true
property to the override.properties
file if you are creating a Cooperative Portlet Source that will use the Type Property Broker Link.
Key objects this builder creates
When used to create portlets that can communicate with one another, the key objects this builder creates are:
- This builder creates a method named pbAction_<builder name> that is used to initiate the event. A Property Broker Link type will automatically call this, but you must manually invoke this if you are creating you own UI using the Property Broker Action type
A complete sample shows you how to use IBM® WebSphere® Portlet Factory to implement inter-portlet communication including Property Broker, Click-to-Action, Portlet Factory events, and shared variables.
More about this builder
When portlets communicate with each other, an action or event that occurs in a source portlet can result in messages being sent to other portlets. These messages might update data or cause other display changes.
One or more cooperative portlets on a portal page can automatically react to changes from a source portlet triggered by an action or event in the source portlet. Portlets that are targets of the event can react so that users are not required to make repetitive changes or actions in other portlets on the page.
Cooperation between source and target portlets is facilitated by a IBM WebSphere Portal runtime entity called the Property Broker. Portlets on a page can cooperate in this way even if they were developed without the expectation of cooperation.
This Builder supports three kinds of inter-portlet communication formats:
JSR 286 Events
The Cooperative Portlet Source and Cooperative Portlet Target builders support the event functionality which is part of the Java Portlet Standard 2.0 API (JSR 286). Event declarations are added to the JSR 286 deployment descriptor (portlet.xml), as opposed to the WSDL files used by the JSR 168 Property Broker events. The event declarations are added automatically through the use of the Cooperative Portlet builders, and the WebSphere Portlet Factory war creation process. The Cooperative Portlet Source builder describes the events that the portlet publishes, and the Cooperative Portlet Target builder describes the events that the portlet can process. Event names are made up of the output/input "Name" and "Namespace" which makes them uniquely identifiable. The "Name" and "Namespace" form the QName of the event. Standard (JSR 168) implementations
Events can pass a single object, which must have a valid JAXB binding, or be in the list of Java standard classes of the JAXB 2.0 specification. To send an event from a source portlet to the target, the event QName and data type must match. The "Output Type Name" and "Input Type Name" builder inputs are not used for JSR 286 events and are ignored. Event declaration can optionally specify a list of Aliases to provide alternate QNames that are used when matching events against each other. This is useful when communicating between JSR 168 cooperative portlets and JSR 286 event portlets. See the JSR 286 specification for complete details on these events.
For use in portlets built in accordance with the Java Portlet Standard 1.0 API (JSR 168) Click-to-Acton (C2A) implementations
For use in legacy portlets built in accordance with the deprecated WebSphere Native portlet APINote:
Click-to-Action is a legacy WebSphere Portal feature that provides automatic frontend integration of portlets. Using C2A, users can transfer data from one portlet to another, and have the target portlet react to the data, thus causing information on the page to be refreshed. In the C2A mode, this builder places the <C2A:encodeProperty>
tag on a model page. These tags are used to build a menu that can fire a C2A event to a target portlet on the same page that matches the specified type.
Parent topic: Builder Reference: wpf7
About using the builder call editor: wpf7
How do I use cooperative portlets: wpf7
Cooperative Portlet Target builder: wpf7
Locating control builder calls on pages: wpf7