• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Difference between %include file=""% and jsp:include file=""

 
Markandey Sahu
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any one tell me difference between <%include file=""%> and <jsp:include file=""> and which one is faster?
 
Santana Iyer
Ranch Hand
Posts: 335
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have file index.jsp,

<%@ include file="header.html" %>
This is index page
<jsp:include page="footer.jsp" />

content of header.html file is copied to inclduing page at translation time.

With <jsp:include page="footer.jsp" /> will include content of footer.jsp at request time.

When first jsp is translated to servlet java class in case of directive it includes file content (at translation time contents are included).

With jsp:include a runtime call is included to footer.jsp so when user requests index.jsp at that time footer.jsp contents will be included (at request time) and response will be sent to client.

For more information please read some book or do google.
 
Joe Harry
Ranch Hand
Posts: 10080
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Refer here to point number 11...http://faq.javaranch.com/view?ScwcdHints
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can refer to the David Bridgewater's book..chapter 7...for some good graphical explanation...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic