What is the difference between RequestDispatcher and sendRedirect ?

RequestDispatcher: RequestDispatcher.forward(req, res) in forward req, res would be passed to the destination URL and the control will return back to the same method, it will execute at “server side”.

sendRedirect: when ever the client request will come just it will take the request and the request to be forwarded to another page. It cannot forward the http parameters of the previous page. This will work at “client side”. If page1.jsp redirects to page2.jsp, the browser's address bar be updated to show page2.jsp.


Enter your email address to get our daily JOBS & INTERVIEW FAQ's Straight to your Inbox.

Make sure to activate your subscription by clicking on the activation link sent to your email