OGNL的Lambda表达式如何工作呢?
Lambda表达式必须放在方括号内部,#this表示表达式的参数。例如:
<s:property value="#fib =:[#this==0 ? 0 : #this==1 ? 1 : #fib(#this-2)+#fib(#this-1)], #fib(11)" />
#fib =:[#this==0 ? 0 : #this==1 ? 1 : #fib(#this-2)+#fib(#this-1)]定义了一个Lambda表达式,
#fib(11) 调用了这个表达式。
所以上述代码的输出为:89
在JSP2.1中#被用作了JSP EL(表达式语言)的特殊记好,所以对OGNL的使用可能导致问题,
一个简单的方法是禁用JSP2.1的EL特性,这需要修改web.xml文件:
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<el-ignored>true</el-ignored>
</jsp-property-group>
</jsp-config>
本文来自CSDN博客,http://blog.csdn.net/axzywan/archive/2008/07/12/2643921.aspx
//在ValueStack中存在stbtypelist集合,用ONGL时,用%{}来取值;
<s:select list="%{stbtypelist}" headerKey="0" headerValue="--请选择--" listKey="insideTypeId"
listValue="productName" name="fittype.stbtype.insideTypeId"></s:select>
struts2el和ongl
最新推荐文章于 2024-06-10 19:16:34 发布