昨天碰天这样一种情况,在extreme table中指定了一行,id为row,又想在ognl中取得该row中的字段属性.
发现可以这样写,<s:property value="#attr.row.id"/><s:property value="#attr.row.name"/>
其中id, name为row中的属性名,row是迭代中的一个Bean.
在struts2的OGNL中,数据放在以下几个地方:
(1)ValueStack:这是根路径(ROOT)
(2)request
(3)session
(4)application
(5)attr:当从attr中取数据时,会按page,request,session,application 的顺序进行遍历.通常不同的tag之间交换的数据都可以从attr中取到.