What is difference between forward and sendRedirect()?
This method is declared in HttpServletResponse Interface.
This method is used to redirect clienty request to another location for further processing that may be available on different server or different context. This transfer of control task is delegated to the browser by the container. That is, the redirect sends a header back to the browser / client. This header contains the resource url to be redirected by the browser. Then the browser initiates a new request to the given url. Since it is a new request, the old request and response object is lost.
This method is declared in RequestDispatcher Interface.
The method is used to pass the request to another resource within the same server.This process is taken care by web container when we call forward method request is sent to another resource without the client being informed. This is also called server side redirect.