There are approximately three ways to jump using JSPs:
1 response.sendredirect ();
2. Response.setheader ("Location", "");
3.
has been tested for some of the following rules:
One. Response.sendredirect ()
This statement is not allowed to have out.flus before H (), if there is a out.flush (), there will be an exception:
Java.lang.IllegalStateException:Can ' t Sendredirect () after data has committed to the C Lient.
at Com.caucho.server.connection.AbstractHttpResponse.sendRedirect (abstracthttpresponse.java:558)
... The browser address bar changes after the
Jump
If you want to jump to a different host, after the jump, the statement following this statement will continue to execute as if the new thread was opened, but the operation on response is meaningless;
If you want to jump to the same host, The statement after the execution of this statement does not jump,
Two. Response.setheader ("Location", "")
does not allow Out.flush () before this statement, and if there is Out.flush (), the page does not jump. The browser address bar changes after the
Jump
The statement after the statement is completed is finished before jumping
three.
This statement is not allowed to have Out.flush (), if so, there will be different Often:
Java.lang.IllegalStateException:forward () not allowed after buffer has committed.
at Com.caucho.server.webapp.RequestDispatcherImpl.forward (requestdispatcherimpl.java:134)
at Com.caucho.server.webapp.RequestDispatcherImpl.forward (requestdispatcherimpl.java:101
at Com.caucho.jsp.PageContextImpl.forward (pagecontextimpl.java:836)
... The browser address bar does not change after the
jump, but can only be skipped until the execution of the statement after the statement after the current host is completed before it jumps