Question - What is the use of RequestDispatcher Interface?
Answer -
The RequestDispatcher interface defines the object that receives the request from the client and dispatches it to the resources such as a servlet, JSP, HTML file. The RequestDispatcher interface has the following two methods:
1
public void forward(ServletRequest request, ServletResponse response)
Forwards request from one servlet to another resource like servlet, JSP, HTML etc.
1
public void include(ServletRequest request, ServletResponse response)
Includes the content of the resource such as a servlet, JSP, and HTML in the response.