File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RequestDispatcher

 
Apan Raj
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any ony let me know the different ways of getting RequestDispatcher object in a servlet, and how actually they differ.
 
Ramakrishnan thiyagarajan
Ranch Hand
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
Request dispatcher is a interface.actually RequestDispatcher means to dispatch the incoming Http request to some other servlet or jsp page. this is a concept.but u can obtain it two ways.
throug ServletContext,HttpServletResponse.
 
Sri Basavanahally
Ranch Hand
Posts: 75
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi !
Ramakrishna is right. The methods used are:
You use either the getRequestDispatcher(relative path of resource)
or getRequestDispatcher(absolute path of resource)
or getnamedDispatcher(name of the resource)(Check the method name)
-Sri
 
Apan Raj
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As per the API, there is no much difference between the methods in ServletContext and ServletRequest ( Ramakrishna, its not HttpServletResponse ), except that
the method in ServletContext accept only relative path where as the other method also accept absolute path.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic