A Controller servlet may perform either a forward or a redirect operation at the end of processing a request. It is important to understand the difference between these two cases, in particular with respect to browser reloads of web pages
Forward
- A forward is performed internally by the application (servlet).
- The browser is completely unaware that it has taken place, so its original URL remains intact.
- Any browser reload of the resulting page will simple repeat the original request, with the original URL.
- A redirect is a two step process, where the web application instructs the browser to fetch a second URL, which differs from the original.
- A browser reload of the second URL will not repeat the original request, but will rather fetch the second URL.
- Redirect is marginally slower than a forward, since it requires two browser requests, not one
- Objects placed in the original request scope are not available to the second request.
0 Comments