This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori 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 OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between getRequestDispatcher() from ServletContext and HttpServletRequest
 
It's not a secret anymore!