Two Laptop Bag*
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 Android Security Essentials Live Lessons this week in the Android 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
Diff between getRequestDispatcher() of ServeltRequest and ServletContext interface??
Servlet to Bean to JSP problem
2 ways of getting a RequestDispatcher
Diff getNamedDispatcher() & getRequestDispatcher()
getRequestDispatcher() method