Why isn’t my EL expression evaluated?

In a JSP 2.0 container, such as Tomcat 5, my EL expressions in template text and action element attributes are not evaluated, they are used as-is instead. For instance:


is rendered as:


What have I missed?

The EL evaluation is disabled for a web application with a Servlet 2.3/JSP 1.2 deployment descriptor (web.xml file) for backwards compatibility reasons.

You need to update the web-appelement in your web.xml file to the Servlet 2.4/JSP 2.0 format to enable EL evaluation by default:

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd"

As an alternative, you can enable EL evaluation of a page-by-page basis with the isELIgnored attribute of the page directive, or with a JSP configuration group in the web.xml file.

Leave a Reply

Your email address will not be published. Required fields are marked *