Error : Cannot set RenderParameter after sendRedirect has been called
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:
Following exception can be seen in the logs
Solution:
Just make sure to call the FacesContext response complete after sendRedirect() method is invoked.
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