• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

A question about include directive

 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In HFSJ PAGE 405,it says with the include directive,the source of included thing becomes PART of the page with the include directive
I think it means that include directive can include dynamic page.
But why the option A of question 12 of page 430 is wrong?
 
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Avseq,

I first checked the errata list .

Well, the answer you are looking for is also on page 430 (look the note for Option A) where you have <%@ include ...> and not <jsp:include ...>.

Regards,
Darya
 
avseq anthoy
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by avseq anthoy:
In HFSJ PAGE 405,it says with the include directive,the source of included thing becomes PART of the page with the include directive
I think it means that include directive can include dynamic page.
But why the option A of question 12 of page 430 is wrong?



I think include directive means "<%@include ....%>",so I think the page 405 that says it can include dynamic page.
Do I think wrong?
 
Darya Akbari
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Avseq,

p. 430 Question 12 is not asking anything about include directive but only about dynamic content in a JSP. Hence the explanation why Answer C and not Answer A which is given on p. 430 is correct.

For those who don't have the HFSJ book I put the question here:


QUESTION:

How would you include dynamic content in a JSP, similar to a server-side include (SSI)? (Choose all that apply)

A. <%@ include file="/segments/footer.jspf" %>
B. <jsp:forward page="/segments/footer.jspf"/>
C. <jsp:include page="/segments/footer.jspf"/>
D. RequestDispatcher dispatcher = request.getRequestDispatcher("/segments/footer.jspf"); dispatcher.include(request, response);


ANSWER: C

Option A is incorrect because it uses an include directive, which is for static includes that happen at translation time.



Regards,
Darya
[ September 05, 2005: Message edited by: Darya Akbari ]
 
Not looking good. I think this might be the end. Wait! Is that a tiny ad?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic