i want to know how does response.sendRedirect work ? example : This is my simple jsp --------------- <%@ language="java" import="java.lang.*,java.io.*,java.util.*"%> <% response.sendRedirect("test1.jsp"); System.out.println("1 line"); System.out.println("2 line"); System.out.println("3 line"); System.out.println("4 line"); System.out.println("5 line"); %> ---------------------- This is the test1.jsp <% System.out.println("test1 1"); System.out.println("test1 2"); System.out.println("test1 3"); %> <HTML> <HEAD>
</HEAD> <BODY> this is hushann from cst </BODY> </HTML> -------------------- when I run the first jsp ie test.jsp it redirects the response to the test1.jsp The sequence in which the System.out are printed in my system is first of test.jsp and then of test1.jsp my query was. 1. Is there any logical sequence in which the execution is carried out? 2. Does the server fork another thread to carry out the redirection while it proceeds with the calling jsp ? 3. Should the response at all return to the calling jsp after redirection ? Thanx in advance Prateek
Joined: Jun 13, 2000
JavaRanch has a Naming Policy In order to be entered in the drawing for the book giveaway, your name must meet this policy. Please reregister with a correct name. Carl
Send redirect sends a message to the client (the browser) to redirect to a different page. The sequence is 1)client sends request 1 to server 2) server sends redirect message to client 3-1) server continues processing page 3-2) client sends request for redirect page to server 3-3) server processes request 2 in its own thread After the server sends the redirect request to the client, there are two requests on the server each running its own thread. In the vast majority of cases, the server will finish processing the first request before it starts handling the second. However, its possible that some/all of the second request will get processed before the first request/thread completes.
Joined: Jun 26, 2001
Thanx Avery Gross for the answer . It did clearly answer all me queries And Sorry Carl Trusiak for the mistake in the UserName . I have changed as adviced by you