• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

which RequestDispatcher to use?

 
Mark Stein
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just wondering if there are any rules of thumb as to which RequestDispatcher (ServletContext or ServletRequest) to use, in what cases.
I understand why the ServletContext.RequestDispatcher can't use relative paths.
Thanks
MS
 
Kyle Tang
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the impression that the ServetContext's RequestDispatcher is being deprecated, though the API doesn't explicitly say that.
 
Iftikhar Arain
Ranch Hand
Posts: 95
Flex Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is another difference b/w both dispatchers
a) ServletContext.RequestDispatcher can dispatch the requests to another context / application while request.RequestDispatcher cann't.
Hope this help.
 
Bala Krishna
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is not correct. You can not use the request dispatcher obtained from ServletContext to forward to a web resource that's in a differnt web app. (and thus a different Servlet Context).
-Bala.
 
Vinay Salehithal
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
right, u wd first need to obtain the context for the present application, thru that obtain the context for the other application, then get that context's requestdispatcher... and you are all set.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic