• 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
Description:
File size: 482 Kbytes
[Download fwd_inc.bmp] Download Attachment
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic