For a summary, my problem is I kept seeing this error message:
According to TLD or attribute directive in tag file, attribute value does not accept any expressions
And I find out that problem occurs because I was using JSTL-1.0 in a JSP-2.0 environment. Details can be found here.
Lately, when working on my project and using JSTL again I come against a strange problem. I am trying to use
<c:out value="${foo.bar}" />
and it simply prints ${foo.bar}
.After a quick inspection I found the source of the problem. Again I made mistake using auto-complete in IntelliJ ( sometimes i found this after error occurs, like this time:) ).
So using auto complete, i define core taglib definition like this:
<%@ taglib prefix="c"
uri="http://java.sun.com/jsp/jstl/core"%>
This definition is for JSTL-1.1 and guess what I am using JSTL-1.1 jar and Servlet-2.3/JSP-1.2 web-app(due to some code-generation issues). So i fix this error by changing tld description like this:
<%@ taglib prefix="c"
uri="http://java.sun.com/jstl/core"%>
In conclusion of my older post I state :
So here is the summary for all of my words:
- Servlet 2.3/JSP 1.2 + JSTL 1.0 - OK
- Servlet 2.3/JSP 1.2 + JSTL 1.1 - OK
- Servlet 2.4/JSP 2.0 + JSTL 1.1 - OK
- Servlet 2.4/JSP 2.0 + JSTL 1.0 - PROBLEM
If problem occurs first check
web.xml
and JSTL verisons.Upgrade if you can (highly recommended), if you can't then use "
c-rt.tld
"This is still true. BUT if you want to use
Servlet 2.3/JSP 1.2 + JSTL 1.1
option, you should avoid using JSTL-1.1 tld
definition.