• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mock question regarding dynamic attribute

 
pradeep singh
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
65
Marks: 1 Which of the following statements are true?
Choose at least one answer.
a. Where an attribute implements DynamicAttributes it can be used without being declared in the deployment descriptor
b. Using classes that implement DynamicAttributes requires that they be declared in the deployment descriptor
c. The body of a simpleTag can be accessed using the getJspBody method
d. Simple tags cannot access their body content
e. the SimpleTag getJspBody method returns an object of type JspFragment
f. the SimpleTag getJspBody method returns an object of type JspBody



Answer is given b,c and e .But i want to know why a is wrong .I think we dont declare about dynamic attribute in DD but declare in .tld file.So a is also correct.Please correct me if i am wrong.



Source: Marcus mock exam 3
 
Bk Jacky
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a. Where an attribute implements DynamicAttributes it can be used without being declared in the deployment descriptor

I think above statement is incorrect.Attributes don't implement DynamicAttributes interface it is the tag hander class who implements this interface and accept dynamic attribute.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do attributes implement DynamicAttributes ? Tags implement it, not attributes.
 
pradeep singh
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes ,you are right .
Thankx to clearify my doubt.
 
S Sravs
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Christophe Verre:
Do attributes implement DynamicAttributes ? Tags implement it, not attributes.


yeah
i too had same thought but not sure thanks for the clarification

Regards
Sravanthi
 
Kram Nart
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, option (a) is clear, but why is option (b) valid?

I just read Bryan's tutorial and found nothing mentioned regarding entries in the DD, only TLD.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look again in the tutorial :
 
Kram Nart
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I double-checked, there's no mention of DD configuration for it.


The next step of this tutorial is to discuss how the <formTags:select> custom tag is declared in the TLD. Here is the relevant chunk of the TLD:

code:

<tag>
<name>select</name>
<tag-class>com.example.taglib.FormSelectTagHandler</tag-class>
<body-content>scriptless</body-content>
<description>
This tag constructs an HTML form 'select' tag. It also generates
the 'option' tags based on the set of items in a list passed in by
the optionsList tag attribute.
</description>
<attribute>
<name>optionsList</name>
<type>java.util.List</type>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<dynamic-attributes>true</dynamic-attributes>
</tag>


 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's right !! They probably mixed DD with TLD.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic