• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SCWCD hints

 
Renu Radhika
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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().
This is from scwcd hints.Whats the difference?
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, there seems to be no difference. But the actual difference that I forgot to mention there will be this,

With a RequestDispatcher.forward(), you cannot write to the response but however, you can write to the server console but with a jsp:forward, you cannot even write to the server console. Anyone to confirm this?
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

If you look at the servlet code generated for the JSP containing <jsp:forward> action the container put explicit return after the pageContext.forward request generated for the <jsp:forward> action. Therefore the code after the forward request are not executed.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic