- With response.sendRedirect(), the browser is asked to go get another page. All HTTP parameters of the original request are lost. The browser’s location bar changes.
- <jsp:forward> is more efficient. It forwards the request to the specified JSP page on the server side, without asking the browser to generate a new request. You can only forward to resources served by your application server! It also keeps the state.
The browser’s location bar doesn’t change.
To test it out, check out
<% response.sendRedirect("/docs/ResultingPage.jsp"); %>
The is the JSP page <i>ResultingPage.jsp</i> the forwarding or redirection. <br> <br> Did the browser's location bar change? <br><br> The parameter <i>orderID</i> is set to <%=request.getParameter("orderID")%>.