As far as I remember, there is another difference between sendRedirect() and
RequestDispatcher.forward(). I once tested both alternatives, and I found
that with forward(), the client never gets to know that he hase been sent to
another page, i.e. the URL does not show, the reload button reloads the page
from where the forward was done, etc. I think I remember there were even
problems with links on the page..

>
>The difference between them (sendRedirect and RequestDispatcher) is that
>sendRedirect sends back to a browser a response that it should redirect
>its request to another page/site which implies another request will be
>sent by a browser. On the other hand, RequestDispatcher gives you
>possibilities to send a request forth and back (no matter how many
>times) between web components just on the server side rather then
>forcing to exchange information through the net as in previous case.
>
>I'd rather write:
>
>if (done == null)
>  getServletContext.getRequestDispatcher(relogin).forward(req, res);
>



Reply via email to