Bruno Farache wrote:
Is it possible to get PortletPreferences from an Action? I mean, is there
some way to retrieve RenderRequests and ActionRequests from Actions?
Yes, as the ActionRequest and RenderRequest are available (by the Portlet
Spec.) as request attributes.
See Portlet Spec 1.0, PLT.16.3.2, Included Request Attributes:
Attribute Name Type
javax.portlet.config javax.portlet.PortletConfig
javax.portlet.request javax.portlet.RenderRequest
javax.portlet.response javax.portlet.RenderResponse
Note: the Portlet Spec only (formally) defines this during a RenderRequest, but the Struts Bridge also provides these attributes during a ActionRequest
processing, in which case you will have to cast it appropriately.
The next version of the Portlet Spec (which will become available sometime this
year) *will* formally support this during ActionRequest processing too.
Example usage:
if (
request.getAttribute(StrutsPortlet.REQUEST_TYPE).equals(StrutsPortlet.ACTION_REQUEST)
)
{
ActionRequest actionRequest =
(ActionRequest)request.getAttribute("javax.portlet.request");
// actionRequest handling
}
else
{
RenderRequest renderRequest =
(RenderRequest)request.getAttribute("javax.portlet.request");
// renderRequest handling
}
Regards, Ate
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]