IBM Websphere Portal V5: A Guide for Portlet Application Development

 < Day Day Up > 

Using the broadcast feature of the cooperative broker, users can send the same data to all portlets on the page with matching actions. The target cooperative portlet of a broadcast can use the declarative or programmatic approach to publish properties.

To include the broadcast menu item to the HRPortlet , proceed as follows :

  1. Open the JSP HRPortlet/Web Content/hrportlet/jsp/html/HRPortletView.jsp.

  2. In the encodeProperty tag, include the broadcast attribute so it looks as shown in Example 13-1.

    Example 13-1. The broadcast attribute enables the broadcast feature.

    <P> <C2A:encodeProperty name="<%=results.getColumnName(col).toString()+\"Param\"%>" namespace="http://www.ibm.com/wps/c2a/examples/hrdetails" type="<%=results.getColumnName(col)%>" value="<%=results.getCacheValueAt(row, col).toString()%>" broadcast="true"/> <%=results.getCacheValueAt(row, col)%> </P>

  3. Test the application as described in the last chapter. Do not forget to enter the database attribute in the Edit mode of both the Employee and Department Details Portlets.

  4. From the cooperative portlet menu choose Invoke all actions . Now both details portlets display the details of the selected department number.

Figure 13-2. Choose Invoke all actions to broadcast the data to all portlets

 < Day Day Up > 

Категории