Enable cooperative targets

 

+

Search Tips   |   Advanced Search

 

Enabling cooperative targets for both Click-to-Action and wired portlets includes the following activities:

  1. Enabling the cooperative target
  2. Implementing the action
  3. Providing translations

To enable a cooperative target:

  1. In the Project Explorer view, select a portlet or the Portlet Deployment Descriptor. Portlets are displayed when you expand the Portlet Deployment Descriptor node under the portlet project folder.

  2. Right-click the desired portlet and select...

    Cooperative | Enable ...this Portlet to Receive Data (Target)

    Alternatively, open a JSP file, ensure that it has focus, and select the option...

    Page | Cooperative | Enable this Portlet to Receive Data (Target)

  3. On the page titled...

    Describe the Type of Data Being Received

    ...provide values for the following fields:

    Target portlet

    Select the portlet that you want to use as a source. This box will only appear if you have more than one portlet in your workspace.

    Data type URI

    Specify a data type URI. The specified value will be stored in a WSDL file, and will be used to uniquely identify the output property's data type to the cooperative runtime environment. The menu contains all existing Name-Namespace pairs defined in the WSDL.

    Note: For this portlet to receive data from a source it must declare an identical Data type URI for the input property as the source has for the output property.

    Java type

    Specify the Java type to be transferred. The value selected in this field will be used to declare the data type in the element of the WSDL.

    Click Next.

  4. On the Property Transfer page, provide values for the following fields:

    [Target action] Name

    Specify the portlet action name. This target action name is used as the invocation target by the property broker. The property broker, once it identifies that the target portlet's input property matches an output property that it previously obtained, will invoke the target action on the target portlet and make the input property value available to the target portlet. The action must be implemented either as a portlet action, a Faces action or a Struts action. For portlet actions, you should use the simple action Strings rather than the deprecated PortletAction class.

    • For JSR 168 portlet API:

      When the cooperative target is a JSR 168 API portlet, the property broker will set this particular parameter in the action request when invoking the target portlet. This is how the property broker communicates to the target portlet that an invocation has occurred, and an input property will be available. Accordingly, in the target portlet control logic, whenever a request parameter of this name is available, with a value matching the value of the Parameter field, it indicates that an invocation by the property broker has occurred.

      For JSR 168 Struts portlets, the action name parameter must be specified as spf_strutsAction.

      For a faces target portlet the user should select the target jsp or a commandButton on the page as the target using the browse button. Or use a custom action if you implemented your own custom portlet class

    • For IBM® portlet API:

      • The Action name specified here is the one that this portlet receives as ActionEvent.getActionString().

      • For a faces target portlet the user should select the target jsp or a commandButton on the page as the target using the browse button. Or use a custom action if you implemented your own custom portlet class.

    Source portlet to portal transfer

    • Where location defines the scope where the input property will be made available by the Property Broker, so that it may be retrieved by the target portlet.

    • Where Property name defines the name of the input property that will be placed in the above location.

    Certain limitations apply:

    • You cannot leave the Property name field blank.

    • You cannot transfer complex data types using the Request Parameter scope or for JSR only, the Render parameter scope.

  5. On the Captions page, enter the following information:

    Resource Bundle

    Choose a properties file from the list, or click

    New to define a new properties file

    In the Captions fields, specify the following:

    Property caption

    Specify a caption for the parameter that contains the output property. This caption is used by the wiring tool to identify a particular output property.

    Note: The field accepts the actual caption value. To specify the key being used, click the Advanced Configuration button.

    Action caption

    • Specify a caption for the parameter that contains the output property. This caption is used by the wiring tool to identify a particular output property.

      Note: The field accepts the actual caption value. To specify the key being used, click the Advanced Configuration button.

  6. Click Next

  7. For your reference, save the Next Steps page by clicking the link to save the page as HTML. The Next Steps page contains a list of steps and sample code that the user needs to perform in order to transfer data between portlets. You can save this page as an HTML document for further reference and automatically have it open in their external web browser.

  8. Click OK.

The Enable Cooperative Target action performs the following tasks for you.

  1. Modifies web.xml to add a servlet class entry to refer to the property broker classes [IBM portlet API only]:

    <servlet-class>com.ibm.wps.pb.wrapper.PortletWrapper</servlet-class>
    <init-param>
       <param-name>c2a-application-portlet-class</param-name>
       <param-value>servlet-class</param-value>
    </init-param>

  2. Modifiesportlet.xml:

    • For an IBM portlet, to add a configuration parameter to each concrete portlet that receives the input property broker through the WSDL file and to specify the base name of a national language resource file.

      <config-param> <param-name>c2a-action-descriptor</param-name> <param-value>WSDL file</param-value> </config-param> <config-param> <param-name>c2a-nls-file</param-name> <param-value>resource bundle name</param-value> </config-param>

    • For a JSR portlet, to add a configuration parameter to each concrete portlet that receives the input property broker through the WSDL file and to specify the base name of a national language resource file.

      <portlet-preferences>
      <preference>
      <name>com.ibm.portal.propertybroker.wsdllocation</name>
      <value>/wsdl/Test.wsdl>/value>
      <read-only>True</read-only>
      </preference>
      <preference>
      <name>com.ibm.portal.pagecontext.enable</name>
      <value>true</value>
      <read-only>true</read-only>
      </preference>
      </portlet-preferences>

      Additionally, for target portlets a config-param for IBM or an init-param for JSR is added for the output property and if you select a JSP page set the JSP action as the target action.

      <config-param>
      <param-name>inputProperty4</param-name>
      <param-value>inputProperty4</param-value>
      </config-param>
      <config-param>
      <param-name>IBMFacesView.jsp.form1.form1.button</param-name>
      <param-value>/IBMFacesView.jsp?form1&form1:button</param-value>
      </config-param>
      or

      <init-param>
      <name>inputProperty4</name>
      <value>inputPorperty4</value>
      </init-param>
      <init-param>
      <name>IBMFacesView.jsp.form1.form1.button1</name>
      <value>/IBMFacesView.jsp?form1&form1:button1</value>
      </init-param>

    • To add a configuration parameter for a Faces portlet to specify the target action name and its parameter name.

  3. Imports an additional library, pbportlet.jar, to /WEB-INF/lib in the portlet project for use of the property broker. [IBM portlet API only]

  4. Creates a WSDL file with the following sections:

    <definitions>

    Acts as root.

    <types>

    The data type is declared using XML Schema Datatypes (XSD).

    <message>

    An output message.

    <portType>

    Defines an abstract collection of operations. <output>.

    <binding>

    Always extended to <portlet:binding> to identify the section as a cooperative binding extension for portlet action invocation.

  5. Generates a resource bundle file that includes the key value (from the key=translated string text format) that was specified in

    Label field in the

    Enable Cooperative Target dialog.

 

Related concepts

Developing cooperative portlets

Wiring portlets

Faces portlet communication

 

Related tasks

Disabling cooperative sources and targets

Disabling a cooperative source for a source or target portlet

Disabling a cooperative target for a target portlet

Disabling one of multiple cooperative sources

Disabling one of multiple cooperative targets

 

Related reference

Faces direct portlet messaging

Web Services Description Language (WSDL) 1.1

WebSphere Portal Information Center

XML Schema Part 2: Datatypes