Request dispatcher
When a request is received by a servlet, it may choose to either generate the response itself, relinquish processing to another servlet (known as forwarding), or request one or more other servlets to generate portions of the complete response (known as including).
The servlet container provides the request dispatcher mechanism in order to allow a servlet to engage other servlets in generating a response.
A few important rules apply to the process of dispatching a request:
1. A servlet forwards a request when it is either not interested or not able to generate the response. In this case, it wholly delegates request processing to the forwarded servlet. Any output written by the original servlet is flushed.
2. Attributes added to a request are available to the forwarded or included request.
3. The resource being forwarded to, or included, may either be dynamic or static. A dynamic resource, such as a servlet, is invoked to generate the output, whereas a static file is directly...