Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

confused with how to include contents of a file

 
Arvind Mahendra
Ranch Hand
Posts: 1162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I may not have used proper subject line but.

What is the difference between the 4 below:

1. <%@include file="copyright.html" %>
2. <jsp irective.include file="copyright.html"/>
3. <jsp:include page="copyright.html"/>
4. <%@include page="copyright.html" %>
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Offhand, I don't think the fourth one works at all. Right?
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More importantly, what do you think of these choices?
 
Tony Smith
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's testing your syntax, I can't tell what'a exactly on number 2 but I know at least 1 of them is wrong.
[ October 19, 2007: Message edited by: Tony Smith ]
 
Arvind Mahendra
Ranch Hand
Posts: 1162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok. This is a good question from whizlabs.
"Acme website" wants to include its <b>static</b> copyright.html in one of its pages.
Identify the best code fragment which can do it.

I knew <%@ include file> was correct but I had doubts with <jsp:directive.include file> I mistook this to be a standard action so I thought this was dynamic as in runtime but i was wrong this is not a std action rather this is just XML syntax for a static inclusion directive that happens at translation time.

Am I correct about all of the above? Anything I can add to my understanding?

The last option as pointed out is wrong because <%@ include has file attribute but not page.
 
Tony Smith
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes seems like what you are saying is correct. But how many answer is there? 1 or 2? I would definitely picked 1 if it asks me to choose 1. But if it asked me to choose 2, I would pick both 1 and 2.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic