users@javaserverfaces.java.net

Before the Restore View Phase, how would I do a HttpServletResponse.sendRedirect?

From: Todd Patrick <Todd.Patrick_at_dtn.com>
Date: Wed, 8 Nov 2006 11:30:46 -0600

The first time a JSF page loads. I have a PhaseListener that checks if it is before the Restore View Phase. If it is in that Phase, I run a bunch of business logic and what I would like to do is call a HttpServletResponse.sendRedirect based on specific criteria. However, I am returning the following error: java.lang.IllegalStateException: Cannot forward after response has been committed com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.j ava:322) com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.jav a:147) com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase. java:87) com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200) com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117) javax.faces.webapp.FacesServlet.service(FacesServlet.java:198) org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFil ter.java:144) jcifs.http.NtlmHttpFilter.doFilter(NtlmHttpFilter.java:118) OK, this does sense, that I cannot forward after a response has been committed. That I understand. Looking at the JSF 1.1 API, I don't see a method off of the Application or FacesContext that would "redirect" to a different page. Is this possible and how? Thanks, --Todd ----------------------------------------- NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.