This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HFS: ambiguity in coffee cram ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "HFS: ambiguity in coffee cram ?" Watch "HFS: ambiguity in coffee cram ?" New topic
Author

HFS: ambiguity in coffee cram ?

Neil Mc
Ranch Hand

Joined: Oct 20, 2003
Posts: 32
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.
Colin Fletcher
Ranch Hand

Joined: Sep 10, 2004
Posts: 200
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 ?


SCJP 1.4 SCWCD 1.4
Neil Mc
Ranch Hand

Joined: Oct 20, 2003
Posts: 32
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.
Kathy Sierra
Cowgirl and Author
Ranch Hand

Joined: Oct 10, 2002
Posts: 1572
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

Joined: Oct 20, 2003
Posts: 32
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HFS: ambiguity in coffee cram ?
 
Similar Threads
JasperException when trying to pass non-String custom taglib attribute.
Parent reference can't access child method but whats happenning here? CLEARED THANKS.
Is this answer right?
problem in understanding jstl set tag
jsp:useBean - setProperty HFS 414 query