Error : Cannot set RenderParameter after sendRedirect has been called

0 comments



Problem Statement: Requirement is that you want to invoke a sendRedirect() method and trying to redirect to a servlet to perform some action. Exception occurred when you invoke sendRedirect() method from a JSF action inside a JSF portlet as follows:

ActionResponse response = (ActionResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();
response.sendRedirect("URL");

Following exception can be seen in the logs

"com.ibm.ws.portletcontainer.core.impl.ActionResponseImpl setRenderParameter EJPPC0161E: Cannot set RenderParameter after sendRedirect has been called"

Solution:

Just make sure to call the FacesContext response complete after sendRedirect() method is invoked.

FacesContext.getCurrentInstance().responseComplete();

No comments:

Post a Comment

Recent Posts

Popular Posts

© 2011-2019 Web Portal Club