记Struts 2不再支持在struts tag里使用JSP EL表达式
来源:互联网 发布:国外域名注册 支付宝 编辑:程序博客网 时间:2024/06/03 19:52
当你使用struts 2 tags时,如果使用代码:
<s:set name="name" value="<%= "'" + request.getParameter("name") + "'" %>" />
或者 <s:set name="name" value="${param.name}" />
都会发生下列错误:
According to TLD or attribute directive in tag file, attribute value does not accept any expressions
而得使用如下,可行:
<s:set name="name" value="#parameters.name[0]" />
原因可能是因为你使用了<%%>代码等。struts2从2.0开始已经不支持struts tag和el表达式的混合使用,而只支持ognl。
Trick Tip:
对于<s:property>,是使用
<s:property value="#parameters.name" />
而对于<s:set>,则要使用(否则出错):
<s:set name="name" value="#parameters.name[0]" />
但是如果使用struts include tag来传参数,则<s:property>和<s:set>无法获取传来的参数,如:
<body> <s:include value= "/welcome.jsp"> <s:param name="name">Scott</s:param> </s:include> </body>
那么在webcome.jsp里通过<s:property>和<s:set>无法获取"name"参数:
<s:property value="#parameters.name" />
<s:set name="name" value="#parameters.name[0]" />
而只能够用
<%request.getParameter("name")%>
来获取
- 记Struts 2不再支持在struts tag里使用JSP EL表达式
- Struts 2不再支持在struts tag里使用JSP EL表达式
- Struts 2不再支持在struts tag里使用JSP EL表达式
- jsp默认语法、EL、JSTL表达式,JSTL和struts Tag标签的使用总结
- Jsp在Struts 2中使用JSON Ajax支持
- Jsp在Struts 2中使用JSON Ajax支持
- JSP EL标签不能和struts tag 一起使用,只能和JSTL一起使用了。
- java默认语法、EL、JSTL表达式,JSTL和struts Tag标签的使用总结
- 注解+Struts+EL表达式
- struts Tag标签使用
- EL表达式、struts标签相关
- 【Struts】--EL表达式罢工了
- 在Struts 2中怎样使用使用JSON Ajax支持
- Struts框架中OGNL标签与EL标签表达式使用
- 第二章 让Tag支持El表达式
- token 在struts里的使用详解!!!!!!!!!
- token 在struts里的使用详解
- 表达式语言(EL)在jsp中的使用
- 用Python来写字符出现频数统计
- 《『若水新闻』客户端开发教程》——11.代码编码(3)
- Video games定义
- 《『若水新闻』客户端开发教程》——12.代码编写(4)
- 字符串转到整型的6种方法
- 记Struts 2不再支持在struts tag里使用JSP EL表达式
- 实习课堂:好的开发人员,不光负责coding
- Linux系统命令及详解
- 从两个例子分析C语言的声明
- SGU 320 The Influence of the Mafia
- 用vector的冒泡排序
- 去掉字符串里的空格
- poj_1276
- 控制台界面控制(七):移动文本