Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Request

 
Vallabhaneni Suresh Kumar
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the difference between forward() and include() methods of RequestDispatcher interface? I am not getting the clear idea. So please help me.
 
Adrian Pang
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it has to do with the control of the response. For include, the calling servlet has the control of the response. It can set the header, or status, and when the forwarded servlet is done, it can continue to write to the response. For forward, once the calling servlet forwards, it cannot write to the response anymore, and anything that it has written to the response will be cleared. In the other words, for include, the control of the response is "lend" to the other servlet, while for forward the control is "given" to the other servlet.
I hope I am right =)
Adrian
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic