attribute test does not accept any expressions
2016-06-07 16:03
423 查看
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"这样的方式,只是去掉了前面的#。
的时候一直报这个错误,查找了很久,才知道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"这样的方式,只是去掉了前面的#。
相关文章推荐
- 160多个android开源代码汇总
- Linux rz与sz
- java 反射
- ScrollView 不在顶部的问题
- LeetCode-238.Product of Array Except Self
- Hadoop 2.x build native library on Mac os x
- Lowest Common Ancestor of a Binary Search Tree
- android虚拟按键挤压布局和硬件加速
- Java编程性能优化一些事儿
- 量子计算与云计算将“碰撞”出怎样的未来生活?
- 内省_思维导图总结
- python写入中文到文件乱码的问题
- 平衡二叉树构造方法
- Kafka学习整理八(topic管理)
- Python实现农历生日提醒功能
- Mac OSX 下 Hadoop 使用本地库提高效率
- wen前端学习计划
- 两个Fragment之间传递数据
- Bitmap性能问题
- Qt学习之路(43): QDirModel