jQuery in Action, 3rd edition
The moose likes Servlets and the fly likes RequestDispatcher in servletcontext Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "RequestDispatcher in servletcontext" Watch "RequestDispatcher in servletcontext" New topic

RequestDispatcher in servletcontext

Thamarai kannan

Joined: May 05, 2009
Posts: 28

hi can any one give brief description with source for the following question

getRequestDispatcher(String path) of the ServletRequest interface cannot extend outside the current servlet context whereas getRequestDispatcher(String path) of the ServletContext can use the getContext(String uripath) method to obtain RequestDispatcher for resources in foreign contexts.
Vijitha Kumara

Joined: Mar 24, 2008
Posts: 3902

By using ServletContext.getContext() (for the getRequestDispatcher()) servlets can gain access to the resources in other contexts hosted in the same server. But with the ServletRequest.getRequestDispatcher() servlets get the access only to local resources inside the same context as the current request. Check the API for ServletContext.

[How to ask questions] [Twitter]
Thamarai kannan

Joined: May 05, 2009
Posts: 28
k thanks alot...
I agree. Here's the link: http://aspose.com/file-tools
subject: RequestDispatcher in servletcontext
It's not a secret anymore!