ProcessAction() Method
The JSR-168 Specification defines a portlet container that manages portlets.Each portlet’s life cycle contain some specific methods as per JSR-168 namely init(),ProcessAction(),destroy() method etc. . The portlet developer can implement these methods to provide the desired functionality.Among all the life-cycle methods of a portlet one of the most important method is the ProcessAction() method.This ProcessAction() method is Called after the user submits changes to a jsr-168 compliant portlet. It is Intended to process input from a user Interaction.The user must interact with the portlet giving some or the other kind of data to it which must be processed by a portlet.This way we can say that the portlet processing is done in the ProcessAction() method.Even if one tries to maximize the size of the portlet window it calls the ProcessAction() method.
public void processAction(ActionRequest request, ActionResponse response)
throws PortletException, IOException
{
}
The processAction() method is called only by the ActionURL. The other URL i.e RenderURL doesnt invoke the processAction() method.When the form submit button is pressed, the action url is used. The action url indicates to the portal that it is an action request. Responding to the action request, the portal invokes the processAction() method before invoking the render() method.
The request values are obtained from the actionURL in the following way
public void processAction(ActionRequest request, ActionResponse response)
throws PortletException, IOException
{
// get the values submitted with the form
String identity = request.getParameter("parameter1");
String color = request.getParameter("parameter2");
......
}
the way we set the render parameters for the render() method is
public void processAction(ActionRequest request, ActionResponse response)
throws PortletException, IOException
{
......
response.setRenderParameter("parameter1", value1);
response.setRenderParameter("parameter2", value2);
}
No comments:
Post a Comment