Specify where the parameter value is bound. Currently, this attribute
can specify one of the following values only:- render-parameter: [JSR 168 API only] This specifies that the value
is bound as a render parameter in the ActionResponse (output parameters only).
- request-parameter: This specifies that the value is bound as a
parameter in the PortletRequest object. This is the default value if the boundTo
attribute is omitted. Note that for output parameters, a different value should
usually be specified as the default PortletRequest implementation provided
by WebSphere® Portal
does not allow parameters to be set during action processing.
- request-attribute: This specifies that the value is bound as an
attribute in the PortletRequest object.
- session: This specifies that the value is bound to the PortletSession
object.
It is also possible to use this attribute, without using the Click-to-Action
interface provided, when enabling the source portlet .
The following
example shows the actionPerformed() method of the OrderDetailPortlet.java
in the Cooperative Portlets application sample from the Sample
Gallery. The portlet passes the TRACKING_ID parameter to property
broker in its actionPerformed() method. This parameter corresponds to an output
parameter in the binding section of the portlet's WSDL file ( OrderDetail.wsdl,
in this example).
OrderDetailPortlet.java
OrderDetailPortlet.java
...
private static final String PREFIX = ""; //$NON-NLS-1$
public static final String ACTION_NAME = PREFIX + "actionName"; //$NON-NLS-1$
public static final String ORDER_DETAILS = PREFIX + "orderDetails"; //$NON-NLS-1$
public static final String ORDER_ID_ENTRY = PREFIX + "orderIdEntry"; //$NON-NLS-1$
public static final String ORDER_ID = PREFIX + "orderId"; //$NON-NLS-1$
public static final String ORDER_DETAIL_BEAN = PREFIX + "orderDetailBean"; //$NON-NLS-1$
public static final String ORDER_DETAIL = PREFIX + "orderDetail"; //$NON-NLS-1$
public static final String TRACKING_ID = PREFIX + "trackingId"; //$NON-NLS-1$
...
public void actionPerformed(ActionEvent event) {
String actionName = event.getActionString(); PortletRequest request = event.getRequest(); //An action causes the state to be modified
ShippingUtils.setLastModified(request); if (getPortletLog().isDebugEnabled()) {
getPortletLog().debug(Messages.getString("OrderDetailPortlet_action_entry")); //$NON-NLS-1$
} if (actionName.equals(ORDER_DETAILS)) {
request.getPortletSession().setAttribute(
ACTION_NAME,
ORDER_DETAILS);
request.getPortletSession().setAttribute(
ORDER_ID,
request.getParameter(ORDER_ID)); /*
* We do this as tracking id is an out param in the C2A WSDL file
* We write the tracking id in the request so it can be published by
* the broker in the same event cycle
*/
OrderDetail od = ShippingDB.getOrderDetail(request.getParameter(ORDER_ID));
request.getPortletSession().setAttribute(ORDER_DETAIL, od);
request.setAttribute(TRACKING_ID, od.getTrackingId());
} else if (actionName.equals(ORDER_ID_ENTRY)) {
request.getPortletSession().setAttribute(
ACTION_NAME, ORDER_ID_ENTRY);
}
}
...
OrderDetail.wsdl (The property broker receives the tracking
ID parameter from the request attribute.)
...
<binding
name="OrderDetailBinding"
type="tns:OrderDetail_Service">
<portlet:binding></portlet:binding>
<operation name="order_Detail">
<portlet:action name="orderDetails" type="simple" caption="Order.Details" description="Get.details.for.specified.order.id"/>
<input>
<portlet:param name="orderId" partname="order_Id" caption="order.id"/>
</input>
<output>
<portlet:param name="trackingId" partname="tracking_Id" boundTo="request-attribute" caption="tracking.id"/>
</output>
</operation>
</binding>
...