File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RequestDispatcher

 
Mathew Lee
Ranch Hand
Posts: 238
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,

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
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is more appropriate to the servlets forum, so it's been moved.

The request dispatcher is the means by which resources are included into a request, or in which request are forwarded to other resources.
 
Javin Paul
Ranch Hand
Posts: 295
Eclipse IDE Firefox Browser Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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 "/"

 
Mathew Lee
Ranch Hand
Posts: 238
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>>>former looks for resource from current path while later looks for resource form absoluter path "/"

I have not understood above point. what you mean by current path and absoluter path. Can you please elaborate.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic