[Opensource] how to do a redirect from a controller?

larry hamel expresso at codeguild.com
Fri Mar 28 19:53:12 PST 2003


see Controller.redirectRequest()

make sure not to flush any output to the client browser before a redirect.  the error you cite is a result of the servlet/controller beginning to return data to client ("committing the response") and then trying to redirect too late.

larry


At 02:47 PM 3/28/2003, you wrote:

>I would like to use the method response.sendRedirect(url) in my process state but when I try that I get this error 
>
>java.lang.IllegalStateException: Cannot forward after response has been committed
>        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:368)
>        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356) 
>
>This is not an Expresso problem but I wonder how others have done this?  
>
>One alternative seems to be to create a redirect.jsp page like is done in the jsp pages which redirects from the jsp.  That would work but I wonder if there might be a better way.
>
>Thanks 
>
>Kris 




More information about the Opensource mailing list