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 getRequestDispatcher 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 "getRequestDispatcher" Watch "getRequestDispatcher" New topic
Author

getRequestDispatcher

sarah Marsh
Ranch Hand

Joined: Mar 06, 2001
Posts: 282
Hello:

What is the difference between the getRequestDispatcher(String path) method of javax.servlet.ServletRequest interface and javax.servlet.ServletContext interface?

Thanks in advance.
ckm supraja
Greenhorn

Joined: Jun 18, 2004
Posts: 2
The getRequestDispatcher(String path) method of javax.servlet.ServletRequest interface accepts parameter the path to the resource to be included or forwarded to, which can be relative to the request of the calling servlet. If the path begins with a "/" it is interpreted as relative to the current context root.

The getRequestDispatcher(String path) method of javax.servlet.ServletContext interface cannot accepts relative paths. All path must sart with a "/" and are interpreted as relative to curent context root
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getRequestDispatcher
 
Similar Threads
2 ways of getting a RequestDispatcher
Diff getNamedDispatcher() & getRequestDispatcher()
getRequestDispatcher() method
Servlet to Bean to JSP problem
Diff between getRequestDispatcher() of ServeltRequest and ServletContext interface??