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


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Question on tld" Watch "Question on tld" New topic
Author

Question on tld

Bhavna Jharbade
Ranch Hand

Joined: Sep 08, 2005
Posts: 69
Hi Friends,
Please help me in the following question

Consider the following description of a tag in a TLD:

<tag>
<name>SmilyTag</name>
<tag-class>com.enthuware.ctags.SmilyTag</tag-class>
<description>
Replaces emoticons such as , , and with images.
</description>
<body-content>tagdependent</body-content>
<attribute>
<name>name</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>



Which of the following statements regarding the above tag are correct?

Select 2 correct options.

1) It is an empty tag.

2) It may be used as an empty tag.

3) It must have a body.

4) It must implement BodyTag interface.

5) It may take an attribute named 'name'. But if present, its value must be dynamic.


According to me only option 2) is correct, but the mock exam says that options 2)n 4) are correct and the explanation for option 4) it gives is:
Since the body-content is tagdependent, it must implement the BodyTag interface.

I dont know any such relation between body-content and BodyTag....
Anyone please correct me if i am wrong.

Thanks in advance.


SCJP1.4 (86%)
Steven Colley
Ranch Hand

Joined: Feb 18, 2005
Posts: 290
HI Bhavna,

It�s 2 and 4.

2- because even if you have declared a tag with some bodycontent, there is no problem if you use a empty body content.

4- Because if your value for bodycontent is "tagdependent" it means that you shold probably need to read your buffer and treat it rather that just showing it (write in buffer).

Therefore, you would need to extend BodyTagSupport or implements BodyTag to be able to use (doInitBody and setBodyContent(bc) ) for this porpuse (treat the bodycontent from tag).

I Holp to help you!

cya!!


SCJP | SCWCD | SCBCD | SCWSD 5 | SCEA (I) 1.4 | SCEA 5 | IBM SOA 669
Bhavna Jharbade
Ranch Hand

Joined: Sep 08, 2005
Posts: 69
Hi Felipe
Thanks for that explanation.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Question on tld