I would like to know more about RequestDispatcher.When it is ,where, benefits of using it. How to invoke it. Why it needs to be used along with forward() method. Any ideas, suggestions, sample code, resources, links highly appreciated. Thanks in advance
RequestDispatcher is an essential utility class which has two important methods include() and forward() , include () is used in case you would like to include response from some other servlet while forward() is used when you want to forward request to some other Servlet for further processing.
RequestDispatcher is retreived by calling either ServletRequest.getRequestDispatcher() method or the ServletContext.getRequestDispatcher() method.
its important to note the difference between two former looks for resource from current path while later looks for resource form absoluter path "/"