• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RequestDispatcher

 
Yves Torres
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Quick question: do the include and forward methods of RequestDispatcher use the original request method to invoke the service method of the target servlet (doGet or doPost)?

Thanks,
Yves
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Yves,
Could you please check the Naming Policy of the ranch and change your name accordingly ? Thank you
http://www.javaranch.com/name.jsp

About your question, yes they do. If you check the API, you'll notice that you have to pass both response and request to these two methods.
 
Yves J Thorrez
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Done!

The API does not appear to tell me that. So to be clear, it is the target servlet's service method that chooses to call doGet or doPost based on the result of calling getMethod on the passed HttpServletRequest object?

Thanks,
Yves
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
void forward(ServletRequest request, ServletResponse response)
void include(ServletRequest request, ServletResponse response)

Yes, the http method will be the determined from the original request.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic