|
Java™ by example!
|
|
|
What is the difference between <jsp:forward> and response.sendRedirect() ?
- 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() http://www.javaspace.com/docs/DoRedirect.jsp?orderID=100
<jsp:forward> http://www.javaspace.com/docs/DoForward.jsp?orderID=100 DoRedirect.jsp:
DoForward.jsp:
ResultingPage.jsp:
Further Information
Author of answer: Joris Van den Bogaert
Comments to this answer are only viewable by members. Login or become a member!
|
|
|
|
|