Fórum

Portlet development : redirect after an action is executed

Edouard Piot, modificado 12 Anos atrás.

Portlet development : redirect after an action is executed

New Member Postagens: 13 Data de Entrada: 13/05/11 Postagens Recentes
Hi,


I'm currently developping a portlet for Liferay, but I have a problem.

The situation is simple : the main page (view.jsp) displays informations about the ldap password expiration for the current user. Below, there is the link declared as follow :

<portlet:renderurl var="editADPassword">
	<portlet:param name="jspPage" value="/edit.jsp" />
</portlet:renderurl>


It redirects to edit.jsp, which allows the user to update that password when expiration date is near. An action is then triggered when clicking on the "Validate" button of the form :

<portlet:actionurl var="changePwd" name="setADPassword">
	<portlet:param name="jspPage" value="/edit.jsp" />
</portlet:actionurl>


Everything works well, but when the action is finished, I'm redirected to view.jsp instead of edit.jsp ! This is not what I want, because in case of mistake (for example, when a user chooses a new password that doesn't match the enterprise password policy), the error message is displayed on view.jsp and the user has to click again on the link to get back to edit.jsp.

My portlet is quite similar to the example portlet described in Liferay Developer Documentation, but in their case, that works! I can't figure out what I've done wrong...

Thanks for your help!


Édouard
Pavel Horal, modificado 12 Anos atrás.

RE: Portlet development : redirect after an action is executed

New Member Postagens: 14 Data de Entrada: 16/06/11 Postagens Recentes
This is an old message post, but I think it deserves an answer as someone might google it.

When an action request is processed, all render parameters are cleared (according to portlet spec). In your case it means that the default view is being displayed after the action processing.

Solution is to manually set render parameter in the action:
actionResponse.setRenderParameter("jspPage", "/edit.jsp");

or automatically copy action request parameters on to the render request. The latter can be achieved via MVCPortlet (if you are using that) configuration
copy-request-parameters

(check LPS-3746).