Search code examples
jsr286spring-portlet-mvc

RenderParameter vs RenderUrl in portlets


Is there any diffference between these two: This is w.r.t going from ActionPhase to RenderPhase.

1

PortletURL manageUrl = response.createRenderURL();
manageUrl.setParameter("action", "search");

2

ActionResponse.setRenderParameter("action", "search");

When to use one over the other


Solution

  • The first snippet generates an render URL that you will use in your page as a direct link to the render phase with an "action" parameter.

    The second snippet of code add an "action" render parameter to the current request, so after the execution of your action phase, the render phase will have access to this new parameter. It can be used for example to pass data from your action phase to your render phase, or select the right render method if you have several render methods (several method annotated with @RenderMapping).