• Post Reply Bookmark Topic Watch Topic
  • New Topic

include of RequestDispatcher

 
amarkirt saroay
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When and how is the include method of req dispatcher used?
RequestDispatcher rd=request.getRequestDispatcher("/myJsp.jsp");
rd.include(request,response);

What does this statement do?

and what is the differnec between include() and forward methods?
 
Narendhiran Nagarajan
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once the servlet forward the request to another servlet or jsp, then it will not care about the response to the client.

But, when you use include, after processing the request by the second servlet, the response will be send back to the first servlet(which does the include) and then the response will be sent to the client.

See the attachment for more detail...
Filename: fwd_inc.bmp
File size: 494 Kbytes
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
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!