JSTL 的问题(According to TLD or attribute directive in tag file, attribute value do
环境: win2003 tomcat 5.5 JDK1.6上
<?xml?version="1.0"?encoding="UTF-8"?>jsp代码:
<%
@taglib?prefix="c"?uri="http://java.sun.com/jsp/jstl/core"?%>????
???
1+2+3?=?${1+2+3}?<br>????
1+2+3?=?<c:out?value="6"?/>??<br>?
此时执行没有任何问题。
?1+2+3 = <c:out value="${1+2+3}" />执行时就会出现:
According to TLD or attribute directive in tag file, attribute value does not accept any expressions
昨天少了一个jsp,所以一直出现问题。
代码<%@taglib?prefix="c"?uri="http://java.sun.com/jsp/jstl/core"?%>????
写成 ??
<%@taglib?prefix="c"?uri="http://java.sun.com/jstl/core"?%>??
<script>render_code();</script>
?
今天再试。发现JSTL1.1可以用。但是用JSTL1.0时,出现问题。
就是把JSTL1.1的库放到/WEB-INF/lib/ 下。
刚开始我是netbeans 5.5.1中的JSTL库拷贝出来发现可以用。后来用jstl1.1.2的库,也是可以用。
总结:
JSTL1.1的库 在JSP2.0(Servlet 2.4)及以后(推荐用JSTL1.1及以上)用:
<%@taglib?prefix="c"?uri="http://java.sun.com/jsp/jstl/core"?%>??
<script>render_code();</script>
web.xml
?
<script>render_code();</script>
?
在 Servlet2.3及以前,
<%@taglib?prefix="c"?uri="http://java.sun.com/jstl/core"?%>??
<script>render_code();</script>
比2.4以后版本少了jsp
web.xml
?
在Servlet2.3中最好用JSTL1.0,如果用JSTL1.1,请加上
?
在Servlet2.3中最好用JSTL1.0,如果用JSTL1.1,请加上
<?xml?version="1.0"?encoding="UTF-8"?>???
把tld目录下的c.tld拷贝到/WEB-INF?下。
?找到官方下载地址:
http://jakarta.apache.org/site/downloads/downloads_taglibs.html
选择 Standard 1.0 Taglib 和Standard 1.1 Taglib 可以下载jstl1.0和jstl1.1版本。