aspose file tools*
The moose likes Servlets and the fly likes What is the diff between a RequestDispatcher object obtained from Request  & Context Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "What is the diff between a RequestDispatcher object obtained from Request  & Context" Watch "What is the diff between a RequestDispatcher object obtained from Request  & Context" New topic
Author

What is the diff between a RequestDispatcher object obtained from Request & Context

Ameya Thakur
Ranch Hand

Joined: Feb 04, 2004
Posts: 43
What is the difference between a RequestDispatcher object obtained from the Request object and the RequestDispatcher object obtained from the ServletContext ?
Shankar Narayana
Ranch Hand

Joined: Jan 08, 2003
Posts: 134
There is no difference , basically the Request object uses the ServletContexts getRequestDispatcher method.


"Failure is not when you fall down; its only when you fail to get up again."
Ameya Thakur
Ranch Hand

Joined: Feb 04, 2004
Posts: 43
Thanks for the reply as i am not very much sure of the following

1.) request.getRequestDispatcher("url").forward(request,response);

2). getServletConfig().getServletContext().getRequestDispatcher("url").forward(request,response);

One : you can pass relative URL address when using request.getRequestdispather, and absolute URL address when using ServletConfig.getRequestDispatcher.
Two: All request details are not passed when using ServletConfig.getRequestDispatcher. May be it is the query string parameters for the current page that does not reach the page where request is forwarded.

Not very sure of the same

Regards
Ameya
Shankar Narayana
Ranch Hand

Joined: Jan 08, 2003
Posts: 134
Hi,

If you can give a thorough look at the servlet API, your doubts will cleared.

Regards,
Shankar
 
wood burning stoves
 
subject: What is the diff between a RequestDispatcher object obtained from Request & Context