• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

doubt in the forward and include apis

 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic