This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "RequestDispatcher in servletcontext" Watch "RequestDispatcher in servletcontext" New topic
Author

RequestDispatcher in servletcontext

Thamarai kannan
Greenhorn

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
Bartender

Joined: Mar 24, 2008
Posts: 3817

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.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Thamarai kannan
Greenhorn

Joined: May 05, 2009
Posts: 28
k thanks alot...
 
 
subject: RequestDispatcher in servletcontext
 
Similar Threads
java.lang.IllegalArgumentException
RequestDispatcher and thread-safe
problem with RequestDispatcher
Servlet to servlet
Correct answer