my dog learned polymorphism*
The moose likes JSP and the fly likes What is the differences between 2 includes of JSP? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "What is the differences between 2 includes of JSP?" Watch "What is the differences between 2 includes of JSP?" New topic
Author

What is the differences between 2 includes of JSP?

Parsuram panigrahi
Greenhorn

Joined: Feb 18, 2003
Posts: 17
What are the differences between including another file in JSp using <jsp:include file= "foo.jsp" /> and <%@ import page= "foo.jsp" %>? Are both methods same? If they are same why there are 2 ways to include another file? If different what are the adv and disadv of each method?
Regards,
-Parsu.
Chris Baron
Ranch Hand

Joined: Mar 21, 2003
Posts: 1049
Hi Parsuram,
this one post about that item
http://www.coderanch.com/t/282317/JSP/java/include-directive-VS-Include-Tag
prasad bhn
Greenhorn

Joined: May 04, 2001
Posts: 28
<%@ include file="filePath"%> include directive is used to include STATIC files at TRANSLATION time which will be PARSED by JSP Engine.
<jsp:include page="pageURI"/> include action is used to include STATIC / DYNAMIC files at REQUEST PROCESSING time which will NOT be PARSED by JSP Engine.


prasad bhuvanam
arul murug
Greenhorn

Joined: Aug 08, 2002
Posts: 24
To throw some extra light.
Both Static (<%@ include file="filePath"%> ) and dynamic<jsp:include page="pageURI"/> include are there for code reusability.
Static Include includes pages at translation time and dynamic Include includes pages at run time.
Dynamic Include is lot more flexible than the Static at some extra performance cost, as the pages are included at runtime.
For example when you are using Container/Component model like one Page acts as container and other pages act as components. The Dynamic includes gives lot flexibility to make run time decision like what are the components(pages) to include and the ones to omit.
This is not possible when we use Static include as all the pages are included at the translation phase and compiled as one unit.


SCJP2<br />SCWCD<br />UML & OOAD - IBM 486
 
Don't get me started about those stupid light bulbs.
 
subject: What is the differences between 2 includes of JSP?
 
Similar Threads
need a little beginner Tag help
what's the # btw include , pageContext.include and jsp:include
Apache Tomcat 5.0 woes.
Attribute value syntax using taglib
basic html ->JSP-> javabean-> database questions