Multiple choice technology web technology

Why use RequestDispatcher to forward a request to another resource, instead of using a sendRedirect?

  1. Redirects are no longer supported in the current servlet API.

  2. Redirects are not a cross-platform portable mechanism.

  3. The RequestDispatcher does not use the reflection API.

  4. The RequestDispatcher does not require a round trip to the client, and thus is more efficient and allows the server to maintain request state.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

RequestDispatcher forwards a request internally on the server, keeping the original request and response objects intact, which avoids an extra client‑server round‑trip. A sendRedirect instructs the browser to issue a new request, losing request attributes and adding latency. Therefore forwarding is more efficient and preserves server‑side state.