Forums de discussion

6.1.3.1: Unable to redirect to a non-Faces view during the RENDER_PHASE.

Gabriel Frias, modifié il y a 11 années.

6.1.3.1: Unable to redirect to a non-Faces view during the RENDER_PHASE.

New Member Publications: 8 Date d'inscription: 27/07/12 Publications récentes
Hi my Friends,

I hope you can help me with this problem....

Im developing portlets in primefaces and im using redirect to go to another page...

Im using:
contextExternal = FacesContext.getCurrentInstance().getExternalContext();
           contextExternal.redirect(url);

This works fine when I click in a commandbutton... The commandbutton validate params, if the params are null the comandbutton redirects to another page...

Unfornately I have to disapear the commandbutton, so Im using <f:event listener="#{autenticacionBean.cargaInicial}" type="preRenderView" /> in my xhtml page of my portlet and it goes to my method that validates the params but when the params are null the redirect didnt work automaticaly and shows this error:

6.1.3.1: Unable to redirect to a non-Faces view during the RENDER_PHASE.
java.lang.IllegalStateException: 6.1.3.1: Unable to redirect to a non-Faces view during the RENDER_PHASE.
   at com.liferay.faces.bridge.context.BridgeContextImpl.redirect(BridgeContextImpl.java:497)
   at com.liferay.faces.bridge.context.ExternalContextImpl.redirect(ExternalContextImpl.java:149)
   at net.latinus.beans.RelacionConfianzaBean.direccionar(RelacionConfianzaBean.java:112)
   at net.latinus.beans.RelacionConfianzaBean.cargaInicial(RelacionConfianzaBean.java:99)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:328)
   at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:341)
   at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
   at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)

I dont know what to do even I use another form to redirect it like:

facesContext = FacesContext.getCurrentInstance();
nav = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
nav.performNavigation(url + "?faces-redirect=true");

If you have another way to do this atomaticaly please tell me....

Grettings....
thumbnail
Neil Griffin, modifié il y a 11 années.

RE: 6.1.3.1: Unable to redirect to a non-Faces view during the RENDER_PHASE

Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
Sounds like a similar error in this other thread.

Can you provide more detail as to how you are making the commandButton disappear?
Gabriel Frias, modifié il y a 11 années.

RE: 6.1.3.1: Unable to redirect to a non-Faces view during the RENDER_PHASE

New Member Publications: 8 Date d'inscription: 27/07/12 Publications récentes
Thanks Neil for you reply... well as i said with a commandButton the redirect works fine, but i have a request and they dont want a commandButton in the page.

The think is that i have a login that gives to me the params and when i click the in the commandButton the accion verifies the params and it redirect to another page.

But for that request I dont have to use the commandButton anymore, that is why im using <f:event listener="#{autenticacionBean.cargaInicial}" type="preRenderView" /> in my xhtml page, that goes inside my method and technically replace de accion that the commandButton does...

For you reply to other threat i dont use javascript, this jsf with primefaces portlet....

This is what i want to do: first the costumer has to login (in this part I get the params), in another page i have to compare the params, if the params are null it redirects to the login page, but if the params are not null it redirects to other page inside my portlet.

Maybe there is a problem with the bridge

If you have another way to do this please tell me...

Thanks for your help...
thumbnail
Neil Griffin, modifié il y a 11 années.

RE: 6.1.3.1: Unable to redirect to a non-Faces view during the RENDER_PHASE

Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
I would recommend that you look at the source code for the new jsf2-login-portlet demo because the LoginBackingBean performs a redirect that I think might be similar to your requirements.