• 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

HFS page 567, question 18

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
F is listed as a correct answer, it says:

"For each attribute declared and specified in a Tag File, the container creates a page-scoped attribute with the same name."

However, on page 494, bottom block, it says:

"All tag attributes have TAG scope."

Kinda confused here. Is the attribute in a tag file, page scoped or tag scoped? And by page scoped, does it mean the calling page, or the included tag file(page)?

Thx.
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am also getting a little confused here. Are tag attributes tag-scoped or page-scoped? Any input would be really appreciated.

Thanks,
Jayanthi.
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Answer F (question 18 on pg. 567) refers to the implementation of the tag file. The spec says for tag files: "For each invocation to the tag, the JSP Context Wrapper must present a clean page scope containing no initial elements." This page scope is referring to the tag file itself.

The "bang" box on page 494 refers to the usage of the tag in another JSP. Look at the sample in the book:
<myTags:header subTitle="..."/>
${subTitle} //This won't work! The attribute is out of scope

Guido
 
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've concluded that this question is a bit of a cheap shot.

There are really two page scopes when you are talking about "the Tag File model". You have the original jsp context (from the calling page), and the new one the container has to create inside the tag. The spec says:

"For each attribute declared and specified, a page-scoped variable must be created in the page scope of the JSP Context Wrapper. For each attribute declared and specified, a page-scoped variable must be created
in the page scope of the JSP Context Wrapper."

Which almost exactly matches answer "F", but it's the "almost" that's the problem. In the spec, just above the quote, they spend a whole lot of time explaining that this is not the JSP Context Wrapper from the originating page. "F" doesn't indicate at all which page scope it's talking about.

The question would be answerable if instead of "the container creates a page scope attribute", it said "witin the tag's jsp context, the container creates a page scoped attribute", but even that would be hard!

The only good thing is that it makes one read the spec! I'm convinced that that's why this question is designed this way!

--Dale--
 
reply
    Bookmark Topic Watch Topic
  • New Topic