Struts2的投影,也就是过滤。 <s:property value="users.{^#this.age>1}.{age}"/> “^”(小尖号)代表开头,指的是:大于一的集合那些元素里头开头的第一个,它的age值的集合 <s:property value="users.{$#this.age>1}.{age}"/> “$”[dolar]代表结尾,指的是: 大于一的集合那些元素里头结尾的那个,它的age值的集合 <s:property value="users.{$#this.age>1}.{age} == null"/> 用来判断集合里面有没有元素。 用中括号访问元素 []:<s:property value="[1]"/> 得出的结果是value stack栈的第二个,依据先进后出的原则,如果要访问栈顶,也就是action对象,则 <s:property value="[0"/>可以得到 |
|