The forward and redirect operation both replace content. The current page is terminated and is replaced with the output of the specified page.
Both <jsp:forward>; and RequestDispatcher.forward() are server side redirects. The redirect operations are performed in the server side, and the browser is unaware of the change. If page1.jsp forwards to page2.jsp the browsers address bar will still show page1.jsp.
The response. Redirect() is a client side redirect. The redirect operation is passed to the browser, which is aware of the change. If page1.jsp redirects to page2.jsp, the browsers address bar will be updated to show page2.jsp.
Forward operations are faster because all the processing happens at the server side.
Redirect operations update the browser history, however which is often desirable. Forward operations are useful when you don’t want the browsers address bar to be update.
With the sendRedirect() you can connect to any URL outside the web application. Whereas the forward () operation will work only within the web application.
March 24, 2008 at 6:34 am
thanks much, guy