Wednesday, 8 February 2017

RequestDispatcher using eclipse

This video demonstrate how to link one servlet to another rosources like html jsp and servlet

In this video RequestDispatcher interface is use to dispatch the request from one servlet to another resource like html jsp and servlet the RequestDispatcher interface provide two methods 1-forward and include the forward method dispatch the request from one servlet to another rosource and  include the content from another resource .

The RequestDispatcher interface provides the facility of dispatching the request to another resource it may be html, servlet or jsp. This interface can also be used to include the content of another resource also. It is one of the way of servlet collaboration.
There are two methods defined in the RequestDispatcher interface.

Methods of RequestDispatcher interface

The RequestDispatcher interface provides two methods. They are:
  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.