Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question on tld

 
Bhavna Jharbade
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Steven Colley
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!!
 
Bhavna Jharbade
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Felipe
Thanks for that explanation.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic