Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

In which situation I use request or context object for requestDispatcher

 
Malhar Me
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have one question. In which scenario I use

RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(nextJSP); and
RequestDispatcher dispatcher = request.getRequestDispatcher(nextJSP);

I know their programming difference, but I am confuse with the question where and when and which method I will use.

Waiting for reply..
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your choice really. They both do pretty much the same thing (with the one difference you are already aware of).
 
azhar jodatti
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
they both look same but they are much more diffrent from each other...

with request dispatcher you can specify relative path

but with context dispatcher you cant you have to give absolute path......


this what i know.. anything else please
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
azharuddin jodatti wrote:
but with context dispatcher you cant you have to give absolute path......


not really ! starting with "/" also one kind of relative path . if you use context then you must use "/".

realative path comes in two flavor 1.starting with "/" and 2. with out "/"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic