Hi, Suppose i want to call www.yahoo.com. Which method i should use : sendRedirect() or getRequestDispatcher() and why?
Thnx in advance
SCJP 1.4, SCWCD1.4, OCA(1Z0-007)
posted 11 years ago
sendRedirect does a CLIENT-side redirect, so the browser is instructed to fetch a different page instead of the one it requested. requestDispatcher does a SERVER-side redirect or forward, so no network roundtrip is involved, but the new address needs to be accessible through the same servlet container. So in your case you need to use sendRedirect, as the page is on a different server.