Sun Java System Portal Server 7 Configuration Guide

Obtain Portlet Objects in Struts Application

It is possible for struts application to get hold of portlet objects like ActionRequest and ActionResponse. This may be required, for example, to implement EDIT functionality. However, if portlet objects are not used properly, the use of portlet objects in struts application may make it portal dependent and result in the struts application unusable as a standalone application.

The struts Action class can obtain javax.portlet.ActionRequest and javax.portlet.ActionResponse objects using the following calls:

ActionRequest aReq = (ActionRequest) request.getAttribute("javax.portlet.request");
ActionResponse aRes = (ActionResponse) request.getAttribute("javax.portlet.response");

The above two statements return javax.portlet.RenderRequest and javax.portlet.RenderResponse respectively, when called from a JSP page.