Reputation: 61
I am working with Spring MVC portlets on Liferay and I am looking for a way to pass the RequestParam from the ActionRequest to the RenderRequest. Here are the signature of my 2 function.
@ActionMapping(params="action=bookmark_fiche")
public void bookmarkFicheRef(@RequestParam long ficheId, ActionRequest request, ActionResponse response){
...
response.setRenderParameter("action", "view_fiche");
}
@RenderMapping (params="action=view_fiche")
public String showFiche(@RequestParam long ficheId, ModelMap model, RenderRequest request, RenderResponse response){
...
}
The render function showFiche is use by other link and work fine when using
<portlet:renderURL var="rowURL" >
<portlet:param name="action" value="view_fiche" />
<portlet:param name="ficheId" value="${fiche.ficheId}" />
</portlet:renderURL>
but if I use
<portlet:actionURL var="boookmarkFicheRefURL">
<portlet:param name="action" value="bookmark_fiche" />
<portlet:param name="ficheId" value="${SEARCH_CONTAINER_RESULT_ROW.object.ficheId}" />
</portlet:actionURL>
the action phase successes but render phase fail with error:
09:24:39,132 ERROR [http-bio-8080-exec-5][render_portlet_jsp:154] org.springframework.web.portlet.bind.MissingPortletRequestParameterException: Required long parameter 'ficheId' is not present
response.setAttribute("ficheId", Long.toString(ficheId));
does'nt work either ...
Do a way exist to transfert the param without modifying the render method? Thanks
Upvotes: 4
Views: 4071
Reputation: 430
I don't understand if this is what you want but if you want to call the render method from the action method, together with:
response.setRenderParameter("action", "view_fiche");
which you correctly added (sets the render parameter "action"), you should add the ficheId parameter
response.setRenderParameter("ficheId", Long.toString(ficheId));
expected by the render method as well.
Upvotes: 3