When we use forward, then servlet container forwards all request to the target page. but in the case sendRedirect, container makes a new request to the target Page. So in forward , url link doesn't change but in sendRedirect url line change . Because container makes a new request, sendRedirect is much slower than forward. If a target page has no relation with current page , then we can use sendRedirect.
Tuesday, May 14, 2013
sendRedirect, forwardImmediately, setforwardURL
When we use forward, then servlet container forwards all request to the target page. but in the case sendRedirect, container makes a new request to the target Page. So in forward , url link doesn't change but in sendRedirect url line change . Because container makes a new request, sendRedirect is much slower than forward. If a target page has no relation with current page , then we can use sendRedirect.