Show TOC

Function documentationDeferred Expressions Evaluation Locate this document in the navigation structure

 

You can put deferred EL expressions in one of the following places in your JSP components:

  • In the body content of a JSP outside of tag attributes

  • In the body content of a tag file outside of tag attributes

  • As a value of tag attributes in a custom tag used either in a JSP page or in a tag file

Depending on the place where the Web container encounters the deferred expression, the Web container may evaluate the expression, accept it as a string, or throw a translation error.

Features

The elements that influence the Web container's behavior are:

  • The isElIgnored tag in the jsp-property-group element in web.xml

    The default value of this tag is false if missing.

    Example Example

    To disable both standard and deferred expression, use the following code:

    1. <jsp-config>
        <jsp-property-group>
          <url-pattern>*.jsp</url-pattern>
          <el-ignored>true</el-ignored>
        </jsp-property-group>
      </jsp-config>
      
    End of the code.
  • The JSP version of the tag library, provided by the version attribute of the taglib element.

    Example Example

    All tag library descriptors should start with this:

    1. <taglib xmlns=”http://java.sun.com/xml/ns/javaee”
      xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
      xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee
      http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_1.xsd
      version=”2.1”>
      
    End of the code.
  • The JSP version of a tag file may be found in three places is listed in:

    • implict.tld - a tag library descriptor created by the tag library provider and placed in the same directory as the tag file

    • a TLD created implicitly by the Web container. In such cases, the JSP version of an implicit tag library defaults to 2.0.

    • a TLD where the tag file is described

  • The deferred-syntax-allowed-as-literal property of the jsp-property-group element in web.xml

    The default value of this property is false if missing.

    Example Example

    In order exception not to be thrown when deferred EL is found in the body of JSP page, you add the following code:

    1. <jsp-config>
        <jsp-property-group>
          <url-pattern>*.jsp</url-pattern>
          <deferred-syntax-allowed-as-literal>
             true
          </deferred-syntax-allowed-as-literal>
        </jsp-property-group>
      </jsp-config>
      
    End of the code.
  • The isELIgnored attribute of the page directive

    The default value of this attribute is false if missing.

    Example Example

    To disable both standard and deferred expression you can use the following code:

    1. <%@ page isELIgnored ="true" %>
    End of the code.
  • The deferredSyntaxAllowedAsLiteral attribute of the page directive

    The default value of this attribute is false if missing.

    Example Example

    In order exception not to be thrown when deferred EL is found in the body of JSP page:

    1. <%@ page deferredSyntaxAllowedAsLiteral="true" %>
      
    End of the code.

    Caution Caution

    The isELIgnored and deferredSyntaxAllowedAsLiteral attributes of the page directive have precedence over the respective elements and values in web.xml. The isELIgnored and deferredSyntaxAllowedAsLiteral attributes of the page directive override the values of the respective elements in web.xml.

    End of the caution.

Activities

The Web container does not evaluate deferred expressions implemented in template text in tag files or JSP pages. The Web container evaluates deferred expressions if you implement them in attributes of tags in tag files and JSP pages. For the Web container to evaluate an expression in a tag attribute, all of the following conditions must be satisfied:

  • The value of jsp-version is higher than or equal to 2.1

  • The attribute is defined in the TLD as able to accept deferred expressions

  • The deferredSyntaxAllowedAsLiteral page directive attribute has a value of false

  • The deferred-syntax-allowed-as-literal property of the jsp-property-group element in web.xml has a value of false

  • The isElIgnored tag in the jsp-property-group element in web.xml has a value of false AND the isELIgnored attribute of the page directive has a value of false

The Web container accepts deferred expressions in template text in tag files as strings if either of the following conditions is satisfied:

  • The value of jsp-version of the tag file is lower than or equal to 2.0

  • The value of jsp-version of the tag file is higher than 2.0 AND the deferredSyntaxAllowedAsLiteral tag directive attribute has a value of true

  • The value of jsp-version of the tag file is higher than 2.0 AND the isELIgnored attribute of the tag directive has a value of true

The Web container accepts deferred expressions in template text in JSP pages as strings if either of the following conditions is satisfied:

  • The deferred-syntax-allowed-as-literal property of the jsp-property-group element in web.xml has a value of true

  • The deferredSyntaxAllowedAsLiteral tag directive attribute has a value of true

  • The isELIgnored attribute of the page directive has a value of true

The Web container accepts deferred expressions in tag attributes in JSP pages or tag files as strings if either of the following conditions is satisfied:

  • The value of jsp-version is lower than 2.1

  • The deferred-syntax-allowed-as-literal property of the jsp-property-group element in web.xml has a value of true OR the deferredSyntaxAllowedAsLiteral page directive attribute has a value of true

  • The isElIgnored tag in the jsp-property-group element in web.xml has a value of true AND the isELIgnored attribute of the page directive has a value of true

The Web container throws an exception if deferred expressions appear in template text in tag files and all of the following conditions are satisfied:

  • The value of jsp-version is higher than or equal to 2.1

  • The deferredSyntaxAllowedAsLiteral page directive attribute has a value of false

  • The isElIgnored tag in the jsp-property-group element in web.xml has a value of false OR the isELIgnored attribute of the page directive has a value of false

The Web container throws an exception if deferred expressions appear in template text in JSP pages if the properties listed below are missing or if all of the following conditions are satisfied:

  • The deferredSyntaxAllowedAsLiteral page directive attribute has a value of false AND the deferred-syntax-allowed-as-literal property of the jsp-property-group element in web.xml has a value of false

  • The isElIgnored tag in the jsp-property-group element in web.xml has a value of false AND the isELIgnored attribute of the page directive has a value of false

The Web container throws an exception if deferred expressions appear in tag attributes in JSP pages or tag files if all of the following conditions are satisfied:

  • The value of jsp-version is higher than or equal to 2.1

  • The attribute is not defined in the TLD as able to accept deferred expressions

  • The deferred-syntax-allowed-as-literal property of the jsp-property-group element in web.xml has a value of false AND the deferredSyntaxAllowedAsLiteral page directive attribute has a value of false

  • The isElIgnored tag in the jsp-property-group element in web.xml has a value of false AND the isELIgnored attribute of the page directive has a value of false