Aren’t tag attributes declared in the TLD?

image with no caption

With custom tags, including the JSTL, the tag attributes are defined in the TLD. Remember? This is the TLD from the custom <my:advice> tag from the last chapter:

<tag>
    <description>random advice</description>
    <name>advice</name>
    <tag-class>foo.AdvisorTagHandler</tag-class>
    <body-content>empty</body-content>

    <attribute>
        <name>user</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
</tag>

So, these are the things the developer who is using a tag needs to know. What’s the attribute name? Is it optional or required? Can it be an expression, or must it be only a String literal?

But while you do specify custom tag attributes in a TLD, you do NOT specify tag file attributes in a TLD!

That means we still have a problem—how does the page developer know what attributes the tag accepts and/or requires? Turn the page...

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset