Problem with Redirecting after setting Public Render Parameter
mismail Sep 8, 2011 9:55 AMI'm doing IPC using PRP and after setting the render parameter, I'm redirecting to one of my portlets. But I'm getting the exception:
18:53:38,037 SEVERE [application] java.lang.IllegalStateException: sendRedirect
cannot be called after setPortletMode/setWindowState/setRenderParameter/setRende
rParameters has been called previously
- javax.faces.el.EvaluationException: java.lang.IllegalStateException: sendRedirec
t cannot be called after setPortletMode/setWindowState/setRenderParameter/setRen
derParameters has been called previously
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(Met
- hodBindingMethodExpressionAdapter.java:102)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionList
- enerImpl.java:102)
at javax.faces.component.UICommand.broadcast(UICommand.java:387)
at org.ajax4jsf.component.UIDataAdaptorBase.broadcast(UIDataAdaptorBase.
java:1387)
at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:3
29)
at org.ajax4jsf.component.AjaxViewRoot.broadcastEventsForPhase(AjaxViewR
- oot.java:304)
at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:26
1)
at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.j
ava:474)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicat
- ionPhase.java:82)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at org.jboss.portletbridge.AjaxPortletBridge.execute(AjaxPortletBridge.j
ava:1163)
I'm using Gatein 3.1 with JSF 1.2 and RF 3.3. Here is my code snippet:
// Get Faces External Context
ExternalContext externalContext = (ExternalContext)FacesContext.getCurrentInstance().getExternalContext();
// Setting deviceId as Public Render Parameter
Object response = externalContext.getResponse();
if (response instanceof StateAwareResponse) {
StateAwareResponse stateResponse = (StateAwareResponse) response;
stateResponse.setRenderParameter("deviceId",deviceId);
}
// Redirecting to ClientDetails Page
try {
externalContext.redirect("/portal/private/smartConnect/ClientManagement/ClientDetails?portal:componentId=659554289&portal:action=SelectTab&objectId=720263097&ajaxRequest=false&deviceId="+deviceId);
} catch (IOException e) {
System.out.println("******* Exception during redirect : ");
e.printStackTrace();
returnStr = "failure";
}
Please help me what I'm doing wrong?