Multiple choice general knowledge science & technology

Which of the following is an example of dynamic inclusion?

  1. getRequestDispatcher("www.google.com").forward(req,resp);

  2. getRequestDispatcher("www.google.com").include(req,resp);

  3. resp.include(req,resp);

  4. resp.forward(req,resp)

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

The include() method from RequestDispatcher performs dynamic inclusion - it includes the response from another resource during request processing. forward() transfers control completely, and HttpServletResponse doesn't have include/forward methods that take request/response directly. Dynamic inclusion generates content at runtime.