We can do this either by using the
1. javax.portlet.actionScopedRequestAttributes container-runtime option
In this approach we set Attributes in ActionRequest object during action processing and These will
be available to the Render-Request object (during content rendering)
In portlet.xml we can specify this
<container-runtime-option>
<name>javax.portlet.actionScopedRequestAttributes</name>
<value>true</value>
</container-runtime-option>
Ex:
processAction method{
actionrequest.setAttribute("actionStatus", "error");
}
Liferay does this automatically without any run time option in portlet.xml (forwarding request attributes from ActionRequest to RenderRequest )
2. By setting render parameters in the ActionResponse.
In this approach, we set render parameters in the ActionResponse. These will be automatically available in RenderRequest of render method. We can set parameters in ActionResponse using following methods
setRenderParameter(String key, String value)
setRenderParameters(String key, String[] values)
in this method we can only set String and String array. For complex objects we can use approach 1
No comments:
Post a Comment