Difference between forward() of Request Dispatcher and sendRedirect() of Servlet Response



forward() of RequestDispatcher
sendRedirect of ServletResponse
Using forward() method we can send the control from one web component to another web component which are in same application.
Using sendRedirect() method we can send the control from one web component of one application to another web component of same or another web appplication
When we are forwarding control using forward() method then we send the data as an request attribute. 
When we are forwarding control using sendRedirect() method we can send the data as query string.
Forwarding is happening completely at server side and client can not observe that.
Redirecting is happening at server side and client side and client can observe  the change in the url

0 comments :

Post a Comment