I met problem trying to use EL in JSTL tags
Question
I'm trying to use expression language inside jstl tags but strange error occurs.
"According to TLD or attribute directive in tag file, attribute value doesn't accept any expressions"
The code is something like this:
<c:out value="${header['host']}"/>
But next code executes well:
${header["host"]}
<c:out value="hello"/>
I added jstl.jar and standard.jar to WEB-INF/lib/ (and to classpath). Directive for including jstl is standard:
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
JSTL version is 1.1.2
App-server: tomcat 6.0.16
Solution
You must use this URL in your taglib declaration.
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
Be sure your web.xml has declared servlet spec 2.4+
This article has the explanation: How to Reference and Use JSTL in your Web Application
OTHER TIPS
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 the META-INF of jstl-version.jar,select the c.tld,fmt.tld and so on.the lib version must be:
<tlib-version>1.1</tlib-version>