wood burning stoves 2.0*
The moose likes Servlets and the fly likes RequestDispatcher Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "RequestDispatcher" Watch "RequestDispatcher" New topic
Author

RequestDispatcher

Mathew Lee
Ranch Hand

Joined: Jun 08, 2009
Posts: 238

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

Joined: Jan 10, 2002
Posts: 60748
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Javin Paul
Ranch Hand

Joined: Oct 15, 2010
Posts: 281



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


http://javarevisited.blogspot.com - java classpath - Java67 - java hashmap - java logging tips java interview questions Java Enum Tutorial
Mathew Lee
Ranch Hand

Joined: Jun 08, 2009
Posts: 238
>>>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
 
subject: RequestDispatcher
 
Similar Threads
Splitig integers
Do you like twitter ?
Posting to bump up my count...
Constructing overloading
Loading an image