Alex,
 
i used the following and it worked ok with struts2.
 
In JSP :-
 
<s:textfield name="opportunity.opportunityItem[0].quantity" value="12" size="5" 
maxlength="5" theme="simple" cssClass="mandatory" 
onblur="setListPrice(%{#rowstatus.index})"/>

In Action, i have a get/set for opportunity which is an object with the 
following property (with get/setters)
 
     private Collection opportunityItems = new ArrayList(0);

and the following additional method in the opportunity class
 
      public OpportunityItem getOpportunityItem(int occ)
      {
       Collection coll = this.getOpportunityItems();
       Object[] objs = coll.toArray();
       
       OpportunityItem oppItem = null;
       if (objs[occ] instanceof OpportunityItem)
       {        
        oppItem = (OpportunityItem)objs[occ]; 
       }
       
       return oppItem;
      }

you could cast the collection to ArrayList and use .get(occ) but i wanted to be 
able to change collection type.
 
struts2 then takes "opportunity.opportunityItem[0].quantity" and does...
 
getOpportunity().getOpportunityItem(0).setQuantity(12)
 
i've found the utility methods are sometimes needed to handle arrays.
 
if it was just a repeating field you could define a String[] and have the 
fields with the same name and struts would populate it for you.
 
regards
adam                                      
_________________________________________________________________
Do you have a story that started on Hotmail? Tell us now
http://clk.atdmt.com/UKM/go/195013117/direct/01/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to