Search code examples
jspjstlelstruts-1

EL is not interpreted and appears plain vanilla in generated HTML output


I am using Struts1 and JSP. I can access the form property using the <bean:write> tag but I can't do it with the JSTL. Why not? My form is a DynaActionForm.

This statement works:

<bean:write name="myForm" property="origin"/>

This does not work, displays ${myForm.map.origin} plain vanilla:

<c:out value="${myForm.map.origin}"/>

This does not work either, displays ${myForm.origin} plain vanilla:

<c:out value="${myForm.origin}"/>

Solution

  • That can happen if there's somewhere a Servlet/JSP, JSTL and/or web.xml version mismatch. During Servlet 2.3/JSP 1.2, EL was part of JSTL 1.0. During Servlet 2.4/JSP 2.0, EL was moved from JSTL to JSP and JSTL 1.1 shipped without EL. The web.xml version declaration dictates the Servlet/JSP version currently used and must be supported by the target container.

    So, if you're using JSTL 1.0 on Servlet 2.4/JSP 2.0, or are using JSTL 1.1 on Servlet 2.3/JSP 1.2, then you will face exactly this problem. Also, if you're using JSTL 1.1 on Servlet 2.4/JSP 2.0, but the web.xml is declared conform Servlet 2.3 (or doesn't contain any version declaraion), then you will also face exactly this problem.

    All is explained in our JSTL wiki page. You can also find download links to the right JSTL versions and examples of the right version-specific web.xml declarations in there.

    Another possible cause is that you've a <%@page isElIgnored="true"%> declaration in top of the JSP or <jsp-config><el-ignored>true</el-ignored></jsp-config> in web.xml, but that's a too obvious cause to be overlooked.