Re: Redirect before/during page load

Splash Forums PrettyFaces Users Redirect before/during page load Re: Redirect before/during page load

#22171

You are executing your method within RENDER_RESPONSE:

at javax.faces.component.UIComponent.encodeAll(UIComponent.java:928)
at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:266)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:197)

Therefore it is reasonable you get this exception as parts of the page are already rendered. You should do the redirect earlier. Like before RESTORE_VIEW. You could also do this from within a PrettyFaces page action which is executed exactly at this point in time.

Another option would be to use Rewrite as Lincoln mentioned. It’s very easy to implement something like this in Rewrite.