• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp:forward Vs requestDispatcher.forward()

 
Sagar kanchi
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
While I was going through the SCWCD hints provided in javaranch website I came across the following stmt.

A <jsp:forward> effectively terminates the current page. Nothing before the <jsp:forward> or after the <jsp:forward> is written to the response! It is not the same when using a requestDispatcher.forward().

Can anybody explain how both forwards are different and in what aspects?
If it is already explained can somebody guide me to the URL where it is already explained.

Thnx in advance
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only difference between the two is that with <jsp:forward>, your control comes out of the _jspservice() method. But it is not the case with RequestDispatcher.forward() where your control is still within the service() method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic