Can somebody explain why file1 will be displayed instead of jsp2
If the code below is executed in file1.jsp what will the location bar of the browser display after the execution. <jsp:forward page="file2.jsp" /> You answered: A
A file1.jsp B file2.jsp C file1.jsp_file2.jsp D Code will not compile file1.jsp is displayed. A is true. B would be true when using response.sendRedirect
Post by:Carl Trusiak
What is displayed in a browsers Address or Location Bar is the URL requested from the server. Using jsp:forward, the clients single request is past along to the second resource without telling the browser so, the initial url is displayed. On response.sendRedirect, the clients initial rquest is anwsered with the http header set with the Redirect Response code causing the browser to make a new request for the second URL.
Post by:James Zhai
So,RequestDispatcher.forward() is transparent to the browser, unlike HttpServletResponse.sendRedirect