This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Difference between getRequestDispatcher() from ServletContext and HttpServletRequest 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 "Difference between getRequestDispatcher() from ServletContext and HttpServletRequest" Watch "Difference between getRequestDispatcher() from ServletContext and HttpServletRequest" New topic
Author

Difference between getRequestDispatcher() from ServletContext and HttpServletRequest

Pranav Pal
Ranch Hand

Joined: Nov 04, 2007
Posts: 74
What is the difference between RequestDispatcher object got from following two calls:
(1) getServletContext().getRequestDispatcher()
(2) request.getRequestDispatcher()

Thanks..


Hakuna Matata!
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

The difference is stated right in the API.
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletRequest.html#getRequestDispatcher(java.lang.String)
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletContext.html#getRequestDispatcher(java.lang.String)


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Difference between getRequestDispatcher() from ServletContext and HttpServletRequest
 
Similar Threads
getRequestDispatcher
RequestDispatcher
RequestDispathcher
getRequestDispatcher
Diff getNamedDispatcher() & getRequestDispatcher()