13.1 Publishing properties programmatically

 < Day Day Up > 

As mentioned in Chapter 12, "Cooperative portlets" on page 371, each action in a cooperative portlet is associated with a single input parameter and zero or more output parameters that provide information to the action about the objects in which the property value should be bound, such as the request object or the session object.

Note:

Cooperative portlets using the programmatic approach require that you create a wire; for details about creating wires, see 13.5.4, "Wire portlets" on page 440 and 13.4, "Wiring tool" on page 418. This is because property values are transferred to the target portlets only if wires have been created.


Each parameter is associated with exactly one property. Parameters associated with input properties are called input parameters , while those associated with output properties are called output parameters . Instead of actions, target portlets can receive property changes directly through the PropertyListener interface.

The actual transfer of the property can be initiated by one of the following methods :

  1. A user launches a Click-to-Action event from an icon on the source portlet. The icon presents a pop-up menu containing the list of targets for the action. After the user selects a specific target, the property broker delivers the data to the target in the form of the corresponding portlet action.

  2. A user holds the Ctrl key while clicking an action and chooses to have the selection saved persistently as a connection between two portlets, called a wire.

  3. The source portlet can perform a programmatic publish of properties to the broker, when it determines that property values have changed. Such property values are transferred to the target(s) only if wires have been created.

The property broker provides APIs to give developers more control over how portlets handle the input and output properties. In general terms, the programmatic approach might be a better option over the declarative approach when the portlet needs to do the following:

  • Activate or deactivate actions for a session.

  • Change the portlet state but not requiring the portlet to react immediately.

  • Publish output properties using the changedProperties() method.

  • Register actions programmatically instead of declaring them in a WSDL file. This may be necessary when the action or property is not known at development time, such as when a portlet is generated by a builder application.

  • Generate markup content directly in the portlet rather than using JSPs.

The following packages are provided for portlets to publish properties to the property broker programmatically:

  • com.ibm.wps.pb.property

  • com.ibm.wps.pb.portlet

  • com.ibm.wps.pb.service

 < Day Day Up > 


IBM WebSphere Portal V5 A Guide for Portlet Application Development
IBM Websphere Portal V5: A Guide for Portlet Application Development
ISBN: 0738498513
EAN: 2147483647
Year: 2004
Pages: 148

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net