Ryan:
That worked.
I used:
facesContext.responseComplete();
resp.sendRedirect("/mypage.jsf");
To make sure I understand this, by calling the responseComplete and
closing the lifecycle for the page, I've essentially closed the current
page and am now able to move on to the next?
Thanks,
--Todd
-----Original Message-----
From: Ryan.Lubke_at_Sun.COM [mailto:Ryan.Lubke_at_Sun.COM]
Sent: Thursday, November 09, 2006 12:29 PM
To: users_at_javaserverfaces.dev.java.net
Subject: Re: Before the Restore View Phase, how would I do a
HttpServletResponse.sendRedirect?
Todd Patrick wrote:
> 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.
>
Make sure that you call FacesContext.responseComplete() before
performing your redirect, otherwise, the lifecycle will continue.
> 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.j
> av
> 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(ExtensionsF
> il
> 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.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_javaserverfaces.dev.java.net
> For additional commands, e-mail:
> users-help_at_javaserverfaces.dev.java.net
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_javaserverfaces.dev.java.net
For additional commands, e-mail: users-help_at_javaserverfaces.dev.java.net