• 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

HFSJ Mock Exam

 
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
which jsp code would you use to include a static content in a jsp?

1. <%@ include file ="/footer.html" %>
2. <jsp:include page="/footer.html/>

Both 1 & 2 are correct. I think option 2 is for dynamic content. So option 2 should be wrong answer right?

Srividhya
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I think it is that the include directive pastes in the source of the included file at translation time (very static) whereas the <jsp:include> action makes a runtime call to the included resource, picking up any dynamic content but at a performance penalty.

You could use either, but I guess you would use the include directive for better performance if you knew the included content would not change.

Cheers,

Paul
 
Srividhya Kiran
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes Paul even I know the reason but since it was given static inclusion I thought <%@ include> is more appropriate.
 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
footer page is html not jsp. mostly html will have only static contents.

so both the answers are correct.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Srividhya Kiran:
which jsp code would you use to include a static content in a jsp?

1. <%@ include file ="/footer.html" %>
2. <jsp:include page="/footer.html/>

Both 1 & 2 are correct. I think option 2 is for dynamic content. So option 2 should be wrong answer right?

Srividhya



Since the file to be included in both the cases are html, option 1 and 2 are correct. Because in html there is no dynamic content.
[ August 11, 2008: Message edited by: prasanna perumal ]
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As per the Rule
include directive- Support static at translation time
include action - Supports static and dynamic content at runtime.
So you can use both.They did not ask you as performance wise ,which one you would use. So you can mark both as correct.
 
reply
    Bookmark Topic Watch Topic
  • New Topic