• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RequestDispatcher confusion

 
santoshm
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am having trouble understanding the differences between the getRequestDispatcher methods available in the ServletRequest class
and the Servletcontext class.
Please describe the exact difference as i feel even the API documentation is not clear enough on this.
Thanks in advance.
Santosh
 
no more user
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the API tell that:

The difference between ServletRequest.getRequestDispatcher() and ServletContext.getRequestDispatcher() is that the first can take a relative path.

so, here
request.getRequestDispatcher("./html/file.html");
and here
context.getRequestDispatcher("/html/file.html");
is valid code, but its not:
context.getRequestDispatcher("./html/file.html");
------------------
regards,
alex
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic