Show TOC Start of Content Area

Function documentation EL Expressions in Tag Attribute Values  Locate the document in its SAP Library structure

Use

You can use EL expressions with both syntaxes in tag attributes values. The Web container processes such expressions differently depending on the attribute type defined in the TLD.

Features

You can define a tag attribute as one of the following types: static attribute, dynamic attribute, deferred value, or deferred expression. Depending on the attribute type, you can use one or both available EL expression syntaxes.

Activities

The following table summarizes tag attribute definitions and accepted EL expression syntaxes.

Attribute Type

Attribute Type Definition in TLD

Example Use

Argument Type of the Setter Method in the Tag Handler

Description

Static

<rtexprvalue>false</rtexprvalue>

<my:tag static=”aString”/>

Type in the TLD is ignored. The String value is converted to the attribute’s target type (as defined in the tag handler).

The type of such attribute values is always java.lang.String and the value provided must be a String literal. You cannot specify an expression.

Dynamic

<rtexprvalue>true</rtexprvalue>

"literal" or

${employee.id} or

<%= employee.id %>

 

If not explicitly specified in TLD, defaults to java.lang.Object

The default type of such attribute values is java.lang.Object. You can override the default type if you explicitly specify it in the TLD. In an attribute of this type you can provide value of the following types: String literal or EL expression with the ${ and }syntax.

Deferred Value

<deferred-value>

<type>java.lang.String</type>

</deferred-value>

"literal"

javax.el.ValueExpression

 

The default type of such attribute values is java.lang.Object. You can override the default type if you explicitly specify it in the TLD. In an attribute of this type you can provide value of the following types: String literal or EL expression with the #{ and } syntax.

<deferred-value>

<type>int</type>

</deferred-value>

#{employee.Id}

Deferred Method

<deferred-method>

<method-signature>

java.lang.String submit()

</method-signature>

<deferred-method>

"literal"

javax.el.MethodExpression

 

The default method signature  of such attribute values is void . You can override the default signature if you explicitly specify it in the TLD. In an attribute of this type you can provide value of the following types: String literal, or EL expression with the #{ and } syntax.

<deferred-method>

<method-signature>

void getEmployeeProjects(employeeId)

</method-signature>

</deferred-method>

#{employee.getEmployeeProjects}

Dynamic attribute or Deferred Expression

<rtexprvalue>true</rtexprvalue>

AND

<deferred-value>

<type>int</type>

</deferred-value>

"literal" or

${employee.name} or

<%= employee.name %> or

#{employee.name}

 

java.lang.Object

 

The setter method will normally use instanceof to discriminate whether the attribute value is a dynamic attribute or a deferred value.

 

In an attribute of this type you can provide a value of the following types: String literal or EL expression with the #{ and } syntax or with the ${ and } syntax. The value of the attribute is processed as a deferred value or deferred method if you use the #{ and } syntax. The value is considered a dynamic attribute otherwise.

<rtexprvalue>true</rtexprvalue>

AND

<deferred-method>

<method-signature>

void getEmployeeProjects(employeeId)

</method-signature>

</deferred-method>

"literal" or

${employee.employeeProjects} or

<%= employee.getEmployeeProjects () %> or

#{employee.getEmployeeProjects }

 

 

End of Content Area