According to TLD or attribute directive in tag file, attribute items does not accept any expressions
2014-03-28 00:15
435 查看
前言
好久没写JSTL的EL表达式了,在执行某jsp页面时突然出现一个异常,具体情况如下:According to TLD or attribute directive in tag file, attribute items does not accept any expressions
简单的翻译一下就是:对应的tag属性不支持表达式传入。
问题原因
应用部署的时候出现该异常,可能的原因是使用了JSL2.0版本,同时又没有使用JSTL core库的备用版本,简单来说就是你的JSTL版本和web.xml版本不匹配造成的。解决方法
1、使用JSTL1.1(推荐方法)使用JSTL1.1Z这时的伪指令应该为:<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
2、如果不想使用JSTL1.1而是使用1.0的话,可以有如下方法
1)使用JSLT RT core备用库
JSTL core库的有两种taglib伪指令, 其中RT库即是依赖于JSP传统的请求时属性值, 而不是依赖于EL来实现(称为EL库.JSP2.0将支持EL)
JSP中使用<%@ taglib uri=http://java.sun.com/jstl/core prefix="c"%>在2.3版本都可以,在2.4就不行了,
这是版本不兼容引起的
此时改写指令为:<%@ taglib uri=http://java.sun.com/jstl/core_rt prefix="c"%>
2) 修改web.xml
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
改为2.3版本的 <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app>
相关文章推荐
- JSTL Exception: According to TLD or attribute directive in tag file, attribute items does not accept any expressions Solution
- 使用JSTL 报According to TLD or attribute directive in tag file, attribute items does not accept any expressions
- according to tld or attribute directive in tag file attribute items does not accept any expressions
- According to TLD or attribute directive in tag file, attribute items does not accept any expressions
- According to TLD or attribute directive in tag file, attribute items does not accept any expressions
- According to TLD or attribute directive in tag file, attribute items does not accept any expressions
- According to TLD or attribute directive in tag file, attribute items does not accept any expressions
- struts2标签:According to TLD or attribute directive in tag file, attribute xxx does not accept any expressions
- EL表达式报错: According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- 错误:According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- JSP中出现According to TLD or attribute directive in tag file, attribute value does not accept any expressions(转贴)
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions