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

Question - RequestDispatcher from ServletContext

 
dharshini madhana
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Why is it MUST to use the forward slash with the getRequestDispatcher() method of the ServletContext.

whereas it is not mandatory for the getRequestDispatcher() method of the ServletRequest



Regards
Priyadharshini
 
bengt hammarlund
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that's because the ServletContext only have information about the context, and do not have any ideia of the request's path. But this info (the path of the request), it's necessary for supporting the relative not-back-slash String path, that the dispatcher ServletRequest gives you support.
 
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!