aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Custom Tag Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Custom Tag Question" Watch "Custom Tag Question" New topic
Author

Custom Tag Question

Ashley Bideau
Ranch Hand

Joined: Apr 22, 2006
Posts: 40
For a tag to accept any valid jsp code as its body, what should be the value of <body-content> for this tag's taglib descriptor?

Select 1 correct option.

a) JSP

b) jsp

c) tagdependent

d) The <body-content> subelement itself may be absent.

I thought it to be a) but mock engine says d). Can some one explain?

Thanks
Ashley

SCJP 5.0
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

I thought JSP was the default (meaning that's what it is if you don't specify the tag at all) value, which would make A and D both correct.


A good workman is known by his tools.
Rodrigo Alvarez
Ranch Hand

Joined: Apr 10, 2006
Posts: 75
http://www.coderanch.com/t/171574/java-Web-Component-SCWCD/certification/body-content-default-value

I agree with them: HFSJ says that <body-content> is mandatory.

Default value is "JSP" in the spec, but this value is invalid for Simple Tag => mandatory <body-content> makes sense to me.

j2eecertiface might be outdated (before the Simple Tag days)


It is a mistake to think you can solve any major problems just with potatoes.<br />--Douglas Adams
Charles Lyons
Author
Ranch Hand

Joined: Mar 27, 2003
Posts: 836
HFSJ says that <body-content> is mandatory.

Default value is "JSP" in the spec, but this value is invalid for Simple Tag => mandatory <body-content> makes sense to me.

j2eecertiface might be outdated (before the Simple Tag days)

I think this explains it; basically it doesn't make sense to have a default value for <body-content> anymore, so it is a mandatory tag without a default value. Instead you would have to specify "JSP" explicitly as the value, making (a) the correct answer to your question as of Servlet 2.4. Of course, if you don't know what else to put there, sensible defaults are "JSP" for classic tags and "scriptless" for simple tags, but these aren't enforced.


Charles Lyons (SCJP 1.4, April 2003; SCJP 5, Dec 2006; SCWCD 1.4b, April 2004)
Author of OCEJWCD Study Companion for Oracle Exam 1Z0-899 (ISBN 0955160340 / Amazon Amazon UK )
Ashley Bideau
Ranch Hand

Joined: Apr 22, 2006
Posts: 40
Thanks Charles for clarification.

-Ashley

SCJP 5.0
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

From JSP 2.0 xsd:
Specifies the format for the body of this tag. The default in JSP 1.2 was "JSP" but because this is an invalid setting for simple tag handlers, there is no longer a default in JSP 2.0. A reasonable default for simple tag handlers is "scriptless" if the tag can have a body.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Custom Tag Question