As explained in the previous section, all kinds of expressions can be used in tag attributes. Which kind of expression and how that expression is evaluated (whether immediately or deferred) is determined by the type attribute of the tag’s definition in the TLD (see Tag Library Descriptors) file that defines the tag.
If you plan to create custom tags (see Chapter 8, Custom Tags in JSP Pages), you need to specify for each tag in the TLD what kind of expression it accepts. Table 5–2 shows the three different kinds of tag attributes that accept EL expressions, and gives examples of expressions they accept and the type definitions of the attributes that must be added to the TLD. You cannot use #{} syntax for a dynamic attribute, meaning an attribute that accepts dynamically-calculated values at runtime. Section 2.3.2 of the JavaServer Pages 2.1 specification refers to these attributes. Neither can you use the ${} syntax for a deferred attribute.
Table 5–2 Definitions of Tag Attributes That Accept EL Expressions
In addition to the tag attribute types shown in Table 5–2, you can also define an attribute to accept both dynamic and deferred expressions. In this case, the tag attribute definition contains both an rtexprvalue definition set to true and either a deferred-value or deferred-method definition.