JSP EL标签不能和struts tag 一起使用,只能和JSTL一起使用了。
2012-05-27 12:07
711 查看
ccording to TLD or attribute directive in tag file, attribute test does not accept any expressions在使用struts2
的标签<s:if test="#name == '1'" 的时候一直报这个错误,查找了很久,才知道struts2中已经不支持EL表达式的使用了,只有JSTL还是支持EL表达式的。
在struts2 中只能使用ONGL了,否则就会报上述兼容性的错误了,大家要注意了。JSP EL表达式只能在struts2 标签外部使用或者和JSTL标签一起使用了。
s:if test="${item.flag} ==0 ">
报错According to TLD or attribute directive in tag file, attribute test does not accept any expressions
原因可能是因为你使用了<%..%>代码 or JSP EL表达式。Struts 2从 version 2.0.11开始已经不支持struts tag与JSP EL表达式混合使用了(不在struts tag里使用EL还是可以的),而只支持OGNL (关于OGNL介绍的中文连接:http://www.blogjava.net/max/archive/2007/04/28/114417.html)。
解决方法:
<s:if test="#request.item.flag ==0 ">
参考:http://blog.csdn.net/totogogo/archive/2008/03/07/2157448.aspx
http://blog.csdn.net/bobojava/archive/2009/08/26/4487343.aspx
1.${}是EL语言的 %{}这样的形式是ognl表过式语言的,在struts2的标签内部,使用%{}这样的形式,在标签外部可以使用${}EL语言的方式。如果在struts2的标签内部使用${}这样的方式,会出现以下的错误提示:
According to TLD or attribute directive in tag file, attribute value does not accept any expressions
2. 很多时候,我们使用struts2的一些标签,属性是需要接受集合的,如果集合是保存在 request,session,或者是值栈(非根对象的栈顶),可以使用#变量名的方式,如果获取的值是在Action中通过特定的方法来获取,就需要使用如 value="userList"这样的方式,只是去掉了前面的#。
的标签<s:if test="#name == '1'" 的时候一直报这个错误,查找了很久,才知道struts2中已经不支持EL表达式的使用了,只有JSTL还是支持EL表达式的。
在struts2 中只能使用ONGL了,否则就会报上述兼容性的错误了,大家要注意了。JSP EL表达式只能在struts2 标签外部使用或者和JSTL标签一起使用了。
s:if test="${item.flag} ==0 ">
报错According to TLD or attribute directive in tag file, attribute test does not accept any expressions
原因可能是因为你使用了<%..%>代码 or JSP EL表达式。Struts 2从 version 2.0.11开始已经不支持struts tag与JSP EL表达式混合使用了(不在struts tag里使用EL还是可以的),而只支持OGNL (关于OGNL介绍的中文连接:http://www.blogjava.net/max/archive/2007/04/28/114417.html)。
解决方法:
<s:if test="#request.item.flag ==0 ">
参考:http://blog.csdn.net/totogogo/archive/2008/03/07/2157448.aspx
http://blog.csdn.net/bobojava/archive/2009/08/26/4487343.aspx
1.${}是EL语言的 %{}这样的形式是ognl表过式语言的,在struts2的标签内部,使用%{}这样的形式,在标签外部可以使用${}EL语言的方式。如果在struts2的标签内部使用${}这样的方式,会出现以下的错误提示:
According to TLD or attribute directive in tag file, attribute value does not accept any expressions
2. 很多时候,我们使用struts2的一些标签,属性是需要接受集合的,如果集合是保存在 request,session,或者是值栈(非根对象的栈顶),可以使用#变量名的方式,如果获取的值是在Action中通过特定的方法来获取,就需要使用如 value="userList"这样的方式,只是去掉了前面的#。
相关文章推荐
- jsp使用jstl、el标签时出现According to TLD or attribute directive in tag file, attribute items does not acc错误
- jsp 中使用 struts 标签 EL 表达式编译不通过
- jsp中使用jstl与EL标签创建九九乘法表
- 直接访问jsp不能使用struts标签
- 使用struts bean:write标签时不能显示Integer,BigDecimal等类型的属性问题的解决
- struts学习笔记 [JSTL]<c:forEach>标签的使用
- idea下Maven项目的webapp下的jsp页面无法使用el或者jstl表达式
- 不能使用JSP EL的解决办法
- jsp简介和el标签 jstl标签
- jsp 自定义标签-SimpleTagSupport 使用笔记
- struts2.1.6s:datetimepicker标签不能使用的问题解决(转载)
- jsp无法支持el标签及jstl标签
- 自定义JSTL 标签(Tag) 项目实践使用总结
- jsp学习---mvc模式介绍和el表达式,jstl标签库的使用入门
- Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/core"(使用forEach时出错)
- 解决Tomcat5中不能在JSP中使用EL的问题
- jsp:jstl标签使用
- jsp 标签库使用小结 JSTL EL表达式 JSP的标签分类
- 在jsp页面中使用struts标签时要注意
- JSP 标准标签库(JSTL)与java代码段<%%>与js结合使用