Controlling the Interpretation of EL Expressions

Starting with JSP 2.0, EL expressions can directly be used in template text and in attribute values for any action element. A JSP application written for a prior version of the JSP specification, however, may use constructs that look like EL expressions and expect them to be used as literal strings instead of being evaluated.

To deal with this potential problem, the JSP 2.0 specification defines two ways to disable EL expression evaluation. First, EL expression evaluation is disabled by default for a web application with a deployment descriptor that is not Servlet 2.4 conformant (i.e., an application developed for a previous version of the Servlet and JSP specifications), and it’s enabled by default for a web application with a Servlet 2.4 deployment descriptor. This guarantees that an old JSP application can be deployed in a JSP 2.0 container with full backwards compatibility, while a sensible default is provided for new applications. Second, the EL expression evaluation can be explicitly disabled in a JSP 2.0 application—for a single page with the elIgnored page attribute, or for a set of JSP pages with an <el-ignored> element in a JSP group:

<web-app ...>
  ...
  <jsp-config>
    <jsp-property-group>
      <url-pattern>*.jsp</url-pattern>
      <el-ignored>true</el-ignored>
    </jsp-property-grop>
  </jsp-config>
  ...
</web-app>

The ability to disable EL evaluation in a JSP 2.0 application allows you to migrate an old application to the new JSP 2.0 features ...

Get JavaServer Pages, 3rd Edition 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.