• 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

What is the differences between 2 includes of JSP?

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 1061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Parsuram,
this one post about that item
https://coderanch.com/t/282317/JSP/java/include-directive-VS-Include-Tag
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<%@ 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.
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic