This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Difference between %include file= Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Difference between %include file=""%  and  jsp:include file=""" Watch "Difference between %include file=""%  and  jsp:include file=""" New topic
Author

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

Markandey Sahu
Greenhorn

Joined: Jun 29, 2006
Posts: 13
Can any one tell me difference between <%include file=""%> and <jsp:include file=""> and which one is faster?
Santana Iyer
Ranch Hand

Joined: Jun 13, 2005
Posts: 335
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

Joined: Sep 26, 2006
Posts: 9344
    
    2

Refer here to point number 11...http://faq.javaranch.com/view?ScwcdHints


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
you can refer to the David Bridgewater's book..chapter 7...for some good graphical explanation...


SCJP 1.4 - 95% [ My Story ] - SCWCD 1.4 - 91% [ My Story ]
Performance is a compulsion, not a option, if my existence is to be justified.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between %include file=""% and jsp:include file=""
 
Similar Threads
Interview questions for JSP
What is the difference between <jsp:include page = ... > and <%@ include file = ... >?.
difference between jsp:include and include directive
include page directives
Another include question