Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

doubt in the forward and include apis

 
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
 
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.

 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • 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
 
On my planet I'm considered quite beautiful. Thanks to the poetry in this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic