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

doubt in request dispatcher concept in servlets

 
Saicharan velury
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm working towards getting certified in Web component development(SCWCD).when i was referring the book "headfirst for jsp and servlets" by Kathy sierra i came across a concept of request dispatcher.after studying the concept i read a statement whose meaning i was unable to understand.The statement is

Depending on the class whose method creates a requestdispatcher the path to the resource to be forwarded to will change.

what's the relationship between the method of the class that created the requestdispacher and the path to the resource the requst will be forwared.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can get the RequestDispatcher via ServletContext#getRequestDispatcher or ServletRequest#getRequestDispatcher. The difference is that the ServletRequest method can take a relative path. I think that is what they mean by "Depending on the class whose method creates a requestdispatcher the path to the resource to be forwarded to will change."
 
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!