Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Request Dispatcher

 
Fisher Daniel
Ranch Hand
Posts: 582
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
I have read about Request dispatcher from Servlet API, but i still confused.
What are the differences between method getRequestDispatcher(String path) and getNamedDispatcher(String path) in Servlet Context class?
thanks
daniel
 
Bhushan Jawle
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getNamedDispatcher takes parameter as name (e.g. servlet name defined in web.xml) against path in getDispatcher
Hope that helps
 
Ken Januski
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm just curious as to whether one is used more than the other. From what I've read it looks like getNamedDispatcher is not mentioned as much in books. Does this mean that it's used fairly infrequently and that most people use getRequestDispatcher? Or is getNamedDispatcher also used fairly frequently?
I know this isn't directly related to certification but I'm just curious.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!