[ model, action ]
here's how the following ognl would resolve:
[0] - a CompoundRoot object that contains our stack, [model, action]
[0].toString() - calls toString() on the first object in the value stack (excluding the CompoundRoot) that supports the toString() method
[1].foo - call getFoo() on the first object in the value stack starting from [OS:action] and excluding the CompoundRoot that supports a getFoo() method
public?class?HomeAction?implements?Action?
{
????private?String?name=?"propertyOfAction";
????private?Person?person=null;
????private?Collection?collection?=?new?ArrayList();
????public?String?execute()?throws?Exception?
{
????????collection.add(new?Person("zkj"));
????????collection.add(new?Person("yql"));
????????collection.add(person);
????????return?SUCCESS;
????}
????public?String?getName()?
{
????????return?name;
????}
????public?Person?getPerson()?
{
????????return?person;
????}
????public?Collection?getCollection()?
{
????????return?collection;
????}
????public?void?setPerson(Person?person)?
{
????????this.person?=?person;
????}
}
<ww:iterator?value="collection"?status="person">
????????????<ww:if?test="#person.first?==?true">?
????????????????[0]?:<ww:property?value="[0]"/></br>
????????????????[1]?:<ww:property?value="[1]"/></br>
????????????????[2]?:<ww:property?value="[2]"/></br>
????????????</ww:if>
</ww:iterator>