What if I have a DynaAction form . In that case how do I handle the getter/Setter method ...
-----Original Message----- From: Rajat Pandit [mailto:[EMAIL PROTECTED] Sent: Sunday, December 14, 2003 3:16 PM To: Struts Users Mailing List Subject: indexed properties mini(est) HOWTO hello, am positng a quick HOWTO to get started with using indexed properties, as i guess almost everyone has had to deal with it atleast once. pls post any suggestions/additions etc to improve on it. i might add on the JSTL version a little version of it. (only the view part changes in that case) just removes the inline scripting in that case. In the View ----------- <html:text name="_put_form_bean_name_here_" property="<%="bidAmount[" + currIdx + "]"%> /> _put_form_bean_name_here_ => put your form bean name here. currIdx = is the indexId from the <logic:iterate...> bidAmount one of the values form the indexed property, property In the formBean ---------------- u should use the property has arrayList as it can grow in size as required. its basically very obvious to guess what will be arguments for the getter and the setter will be, if u look at the view getter (in case bidAmount arraylist stores float type) ------------------------------------------------------ public Float getBidAmount(int idx) { if (idx < bidAmount.size()) { return this.bidAmount[idx] } else { return new Float(0); } } setter (this was the tricky one) -------------------------------- public void setBidAmount(int idx, Float value) { // the while loop will increase the size // to what is required while (idx >= this.bidAmount.size()) { this.bidAmount.add(new Float(0)); } // now just replace the value at the requried position. this.bidAmount.set(idx,value); } -- Rajat Pandit | [EMAIL PROTECTED] IT Consultant Phone: +91 612 3117606 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]