EL expressions won’t executed in Tomcat 5.5, but working in tomcat 6.0.20

But, when I am deploying war file in Unix (CentOS) platform, where I have Tomcat 5.5, the EL expression doesn’t get executed and giving me output like:

${prod.id} ${prod.name}

In other words, the EL expression doesn’t get evaluated at all and is showing as plain text? That can have one or more of the following causes:

  1. Application server in question doesn’t support JSP 2.0.
  2. The web.xml is not declared as Servlet 2.4 or higher.
  3. The <%@page %> of JSP is configured with isELIgnored=true.
  4. The web.xml is configured with <el-ignored>true</el-ignored> in <jsp-config>.

Tomcat 5.5 is Servlet 2.4/JSP 2.0, so #1 can be scratched. You didn’t change anything in webapp before deploying I assume, so #3 and #4 can likely be scratched. Now left #2. Maybe you declared it as Servlet 2.5 for Tomcat 6.0 while the Tomcat 5.5 only understands up to with Servlet 2.4. This way everything will become a mess as Tomcat would then fallback to least compatibility modus. You need to redeclare web.xml as Servlet 2.4 so that it will work in both Tomcat 5.5 and 6.0. The declaration should look like:

<web-app
    xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">

    <!-- Here you go. -->

</web-app>

Leave a Comment