The include() method of RequestDispatcher

Options
- sends a request to another resource like servlet, jsp or html
- includes resource of file like servlet, jsp or html
- appends the request and response objects to the current servlet
- None of the above


CORRECT ANSWER : includes resource of file like servlet, jsp or html

Discussion Board
RequestDispatcher

The RequestDispacher interface provides the facility of dispatching the request to another resource like html, servlet or jsp. It is used to include the content of another resource also. It provides an interface through which the servlets can collaborate with each other. There are two methods that are defined in this:

1) public void forward(ServletRequest request,ServletResponse response)throws ServletException,java.io.IOException:Forwards a request from a servlet to another resource (servlet, JSP file, or HTML file) on the server.

2)public void include(ServletRequest request,ServletResponse response)throws ServletException,java.io.IOException:Includes the content of a resource (servlet, JSP page, or HTML file) in the response.

Rohit Sharma 11-30-2014 07:29 AM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement