• 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: ambiguity in coffee cram ?

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

In the coffee cram for ch 8 question 11 (regarding the <jsp:useBean> std action) there seems to be an ambiguity...

Answer D is given as correct i.e. the statement... "Either the class or type attributes may be specified, but at least one" is given as true.

However, in the bullet point section (pg 414) it states that "the class attibute is optional" (and makes no mention of the type attribute). This makes sense as, in the case where the Bean already exists as an attribute, neither the class or type attributes are required - as the container does not need to create a new object.

The coffee cram answer and the bullet point seem to conflict with each other.

So, which is the case... is 'id' the only required attribute in <jsp:useBean> ?

Thanks for your time,

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

I understand the useBean attribute like this:

useBean id type|class ...

The attribute id is required.
Either the attribute type of class is required.

Do you know what the significance of using the type or class attribute is ?
 
Neil Mc
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yup - Polymorphic references.

The spec seems to say that class can only be ommitted if 'type' is included (i.e. and attribute already exists).

The bullet points on page 414 say "The 'class' attribute is optional". This isn't strictly true and is at best ambiguous on this point.
 
Cowgirl and Author
Posts: 1589
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, the bullet point is ambiguous; you're right. While it is *true*--the attribute IS optional--as you said, it's only optional under the condition that "type" is supplied!

Good catch, and the early statement in the book is exactly how to interpret it (and folows the way it is described in the spec and the exam).

cheers,
Kathy
 
Neil Mc
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Again, thanks Kathy.

Don't think I've ever read a book where the authors are so readily on-hand to answer queries.

Top notch support
reply
    Bookmark Topic Watch Topic
  • New Topic