Enabling cooperative sources with a Faces action

To enable a cooperative source for Faces portlets, you can use a

Command - Hyperlink or

Command-Button component in place of a

Click-to-Action component to trigger portlet communication.

  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 Send Data . The

    Enable Cooperative Source dialog opens. Alternatively, open a JSP page, ensure that it has focus, and select

    Page | Cooperative | Enable this Portlet to Send Data from the menu.

  3. Provide the appropriate values in the

    Enable Cooperative Source dialog box. (See Enabling cooperative sources for a complete description of the fields included in this dialog box.) Click OK.

    Here is an example of the code created in the WSDL file:

    <portlet:action type="standard" name="showTickets"></portlet:action>
         <output>
              <portlet:param name="customerId" partname="customerId_Output"
                   boundTo="request-attribute" caption="Customer ID"></portlet:param>
         </output>
    The cooperatively-enabled portlet is shown with a source portlet icon ( ) in the Project Explorer view.

  4. From the Palette, insert a

    Command - Hyperlink component in the appropriate JSP file.

  5. For JSP only, in the Properties view, add a parameter to the

    Command - Hyperlink component that specifies either the action name parameter you specified in the

    Enable New Cooperative Source to Send Data wizard, or com.ibm.portal.propertybroker.action if you omitted the action name parameter, along with a value attribute that is the action name specified in the WSDL file.

    Note: The parameter name used for a JSR 168 API portlet is com.ibm.portal.propertybroker.action; use com.ibm.faces.portlet.ACTION for a portlet API portlet. For example:

    <f:param name="com.ibm.portal.propertybroker.action" value="showTickets"></f:param>
    In addition, you may want to add another parameter to pass the value of the output property that is available in the page, and use the parameter in the page code (shown in the next step) to store the location (scope) specified by the boundTo attribute in the WSDL file.

  6. In the Quick Edit view, for the Faces action associated with the

    Command - Hyperlink component, store the data to send to the target using the parameter name and scope (specified with the boundTo attribute) in the WSDL file. This is specified by the Location and Property Name you entered in the

    Cooperative - Enable this Portlet to Send Data wizard. For example:

    getRequestScope().put("customerId", customerId);

 

Related reference

Web Services Description Language (WSDL) 1.1

WebSphere Portal Information Center

XML Schema Part 2: Datatypes