I came across a problem trying to use EL in JSTL tags
I am trying to use expression language inside jstl tags, but strange error occurs.
"As per TLD or attribute directive in the tag file, the attribute value does not accept any expression
The code looks something like this:
<c:out value="${header['host']}"/>
But the following code runs well:
${header["host"]}
<c:out value="hello"/>
I added jstl.jar and standard.jar to WEB-INF / lib / (and classpath). The directive to include jstl is standard:
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
JSTL version - 1.1.2
App Server: tomcat 6.0.16
a source to share
You must use this url in your taglib declaration.
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
Make sure your web.xml declares Servlet 2.4+ specification
This article has an explanation: How to reference and use JSTL in your web application
a source to share
check the web app version in your web.xml
<web-app version="2.5" 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/javaee/web-app_2_5.xsd">
and check the jstl uri in META-INF for jstl-version.jar, select c.tld, fmt.tld and so on. The lib version should be:
<tlib-version>1.1</tlib-version>
a source to share