This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
HFSJ wrote:A request dispatch happens on the server, while a redirect happens on the client
Isn't both the methods used in the servlet? Then both should happen at server side right?
Or did i misunderstood what is client/server side?
i think yes you have misunderstood it.by client side or server side you can think here as the entity who is doing the job of redirection.
RequestDispatcher is done by the server. its the server who dispatches the request and response object to the specified url or address.
sendRedirect compels the browser to send a new request to the url specified in the redirect. hence it is done on the client side.
also you can check the final url in the browser. if it is done on the server side the url will be the same but in case of client side it will be different.
SCJP 5.0 SCWCD 5.0
Joined: Oct 04, 2009
avi sinha wrote: the entity who is doing the job of redirection.