model and an action as follows:
[ model, action ]
here's how the following ognl would resolve:
[0] - a CompoundRoot object that contains our stack, [model, action]
[1] - another CompoundRoot that contains only [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
浠ヤ笂鏄痺ebwork鏂囨。涓皥鍒癡alue Stack閮ㄥ垎.鐪嬩簡鏈変簺鏅︽訂,鎴戣瘯楠屼簡涓?涓庡ぇ瀹跺垎浜?(娌$湅婧愪唬鐮?
Action:

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;
聽聽聽聽}
}
鍦╦sp欏甸潰涓?
濡傛灉鎴戜滑鐩存帴
<ww:property value="[0]"/>聽聽 杈撳嚭com.founder.HomeAction@e3ffdf,com.opensymphony.xwork.DefaultTextProvider@d402dd]
<ww:property value="[1]"/>聽聽 杈撳嚭
[com.opensymphony.xwork.DefaultTextProvider@d402dd]
涓鑸垜浠湪娌℃湁寰幆鐨勬儏鍐典笅涓嶇敤[0]聽 [1] 鍙互鐩存帴璁塊棶
<ww:property value="name"/>杈撳嚭聽 propertyOfAction
閭d箞[0] [1] 鏈変粈涔堢敤鍛?鍦ㄥ驚鐜腑灝變綋鐜板嚭鏉ヤ簡.
<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> [0] :[com.founder.Person@b3a5a0, com.founder.HomeAction@e3ffdf, com.opensymphony.xwork.DefaultTextProvider@d402dd]
[1] :[com.founder.HomeAction@e3ffdf, com.opensymphony.xwork.DefaultTextProvider@d402dd]
[2] :[com.opensymphony.xwork.DefaultTextProvider@d402dd]
杈撳嚭浠ヤ笂浠g爜,璇存槑鍦ㄤ竴灞傚驚鐜腑鎴戜滑瑕佽闂甗1]琛ㄧずaction瀵硅薄.鍜屾病鏈夊驚鐜殑[0]瀵瑰簲.
鎬葷粨:
鍋囧浣犵敤webworkNOUI鏍囩,瀵逛簬Value Stack,涓鑸綘涓嶈鑰冭檻[1] [0]涔嬬被鐨?璁頒綇涓鐐?br />濡傛灉鍦ㄥ驚鐜腑action鐨刢ollection灞炴ф椂浣撳唴,鐢╗1]鍙互璁塊棶a(chǎn)ction瀵硅薄鍜屽搴旂殑灞炴?
瀵逛簬澶氬眰寰幆鎴栧鏉傜敤娉?鎴戝彧鑳藉憡璇変綘,浣犵殑璁捐鏈夐棶棰?閲嶆瀯Model浠g爜鍚?

]]>