aspose file tools*
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
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: getRequestDispatcher
 
Similar Threads
Diff between getRequestDispatcher() of ServeltRequest and ServletContext interface??
2 ways of getting a RequestDispatcher
getRequestDispatcher() method
Diff getNamedDispatcher() & getRequestDispatcher()
Servlet to Bean to JSP problem