Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

forward and include of RequestDispatcher

 
Suri Babs
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Difference between forward and include methods of RequestDispatcher?
Anyone please.
thanks in advance
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With forward() you pass on the request to another Web component (servlet or JSP) and say "goodbye" to it. The second component will deal with it and either it or yet another one will be responsible to send the response.
With include(), it's like calling a subroutine to do something and then RETURN to where it was called from and the same component continues to process the request.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic