This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

include of RequestDispatcher  RSS feed

 
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!