Struts integration with cooperative portlets


Struts is a popular programming model for servlets based on the MVC paradigm. WebSphere Portal supports the integration of Struts applications into the portal environment. (see Struts Portlet Framework for details).

Portlets developed using Struts can take advantage of the property broker by following the enablement steps. Struts actions need to be declared in a WSDL file by setting the type attribute on the action element to struts for IBM portlets or standard-struts for JSR portlets. In addition to standard-struts, the actionNameParameter, also in the WSDL file must be set to spf_strutsAction. This is an indication to the property broker to use a special binding to support Struts actions. Here is an example using standard-struts and spf_strutsAction.

 <portlet:action name="/orderDetails.do" type="standard-struts" 
     actionNameParameter="spf_strutsAction"
     caption="orderdetails.order.details" 
     description="orderdetails.get.details.for.specified.order.id"/>
Click-to-Action portlets that used <portlet:binding style="struts"> in previous releases are still supported, although this type of declaration is deprecated.

If a request parameter binding is specified, input parameters will be set on the form bean associated with the Struts action. For other bindings, the portlet needs to retrieve the parameter value from the appropriate place as specified by the binding. It is thus usually preferable to specify a request parameter binding for inputs as the same action logic may be reused for invocation through the broker or direct interaction. Due to the single input parameter restriction for actions invoked through the broker, it might sometimes be necessary to specify a request attribute binding or a session binding, so a complex object (such as a bean) may be passed through the broker. In such cases, the action logic cannot be shared between the brokered and direct invocations. For output parameters, the same choices apply as for default (non-Struts) bindings.

The shipping example using struts has been updated and the sample is provided for both the JSR compliant portlets as well as the IBM portlets.

JavaServer Faces based application development can be applied to portlets in a similar manner that it is implemented in Web applications. The Faces support in IBM Rational Application Developer (Application Developer) simplifies the process of writing JavaServer Faces portlet applications and eliminates the need to manage many of the underlying requirements of portlet applications. For more information on JavaServer Faces development using Application Developer see the documentation installed with Application Developer. Note: Make sure you have the most current iFix applied.

 

See also

Home |

 

WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.

 

IBM is a trademark of the IBM Corporation in the United States, other countries, or both.

 

Rational is a trademark of the IBM Corporation in the United States, other countries, or both.