Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doubt in the forward and include apis

 
raja ram
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

we have three ways to include a file

<%@ include file="test.jsp" %> this is static inclusion
<jsp:include page="test.jsp" /> this is run time inclusion.
what about requestdispatcher.include(req,res)? and in the similar lines we have what is the difference between
<jsp:forward page="test.jsp" /> to foward the request in JSP
and requestdispatcher.forward(request,response) in servlets?

Thanks
 
Shailesh Narkhede
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<%@ include file="test.jsp" %> this is static inclusion
<jsp:include page="test.jsp" /> this is run time inclusion.

this is fine.
now about requestdispatcher.include(req,res):
is same as that of <jsp:include> but it is used in servlets where we are getting requestdispatcher from request or servlet context.

<jsp:forward page="test.jsp" /> to foward the request in JSP
& lines below this line is not processed in that jsp.
requestdispatcher.forward(request,response) this is also same as that of above forword action but used in servlets.

 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi raja ram,for your information,

using tags file also you can include a file .it is in request time
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic