1. What does the forward: prefix do when it is returned from a controller method?
Why: The forward: prefix is a special directive. Spring sees it in the returned String and forwards the request to the given URL inside the server.
2. Which Servlet API method does Spring use to perform a forward?
Why: When Spring finds the forward: prefix, it uses RequestDispatcher#forward to pass the request to the target URL.
3. After a forward is completed, what does the browser's address bar show?
Why: A forward happens inside the server. The browser does not know about it, so the original URL stays the same.
4. How many round trips between the browser and the server happen when a forward is used?
Why: A forward needs only one round trip. A redirect needs two, because the browser must send a second request.
5. Is the client browser involved when the server forwards a request to another URL?
Why: Forwarding transfers the request internally within the same server, without involving the client browser.
6. What is the main difference between forward: and redirect:?
Why: A forward is handled inside the server, so the browser URL stays the same. A redirect sends a response to the browser, which then makes a new request to the new URL.
7. Which return value forwards the request to the URL /orders/list?
Why: The special prefix is forward:. It is followed by the target URL.
8. When a request is forwarded, what happens to the attributes stored in the Model?
Why:InternalResourceView exposes Model entries as attributes on the HttpServletRequest during a forward, rather than automatically pre-populating a separate Model parameter in the target handler method.
9. Who prepares the forwarded URL, including any path variables and query parameters?
Why: Spring does not add path variables or query parameters to a forwarded URL. We have to build the URL manually.
10. Which of the following is one way to send data to the target of a forward?
Why: Since Model attributes are not passed automatically, we can include the data in the forward URL, for example as a query parameter or a path variable.
11. Which object can be used to pass attributes to the target controller method of a forward, instead of adding them to the URL?
Why: We can set attributes on the HttpServletRequest before forwarding. The target controller method can then read them from the same request.
12. Which type of forward is possible with the forward: prefix?
Why: The forward: prefix is commonly used to forward a request from one controller method to another inside the same server.
13. Which other special prefix does Spring provide for returning a URL from a controller, in a similar way to forward:?
Why: Spring supports the special redirect: prefix as well. It sends a new request from the browser, while forward: stays inside the server.