Defining Tag Extra Info Objects

Every custom tag can have an optional Tag Extra Info (TEI) object. The TEI object is used for two purposes:

  • To validate tag attributes at page translation time

  • To specify the scripting variables created by the tag

A TEI class extends the javax.servlet.jsp.tagext.TagExtraInfo class and is defined to the TLD before the tag's body content definition. The following example defines an OptionTagTEI class for the OptionTag used in the case study:

<tag>
    <name>option</name>
    <tag-class>web.OptionTag</tag-class>
    <tei-class>web.OptionTagTEI</tei-class>
    <body-content>empty</body-content>

The TEI class itself must define methods to validate attributes and define scripting variables. These uses of the TEI class are presented ...

Get Sams Teach Yourself J2EE™ in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.