Hi,
I am having trouble binding form parameters on a bean with a collection property.
My command bean:
The jsp page:Code:public class NewGalleryForm { private Collection models = new ArrayList(); public Collection getModels() { return models; } public void setModels(Collection models) { this.models = models; } }
For testing purposes, the command object is initialized in the formBackingObject with a collection models containing three Model objects.Code:<spring:bind path="iuCommand.models[0].name"> <input type="text" name="name" /> </spring:bind>
Now, when I try to set the name on the Model in the JSP page, it consistently gives null in the controller after submitting the form.
NewGalleryController.onSubmit:
Gives:Code:for ( Iterator iter = bean.getModels().iterator(); iter.hasNext();){ Model m = (Model) iter.next(); logger.info("#### model found: " + m); logger.info("#### model name" + m.getName()); }
19 Nov 2004 12:57:46,576 INFO NewGalleryController:45 - onSumbit() called.
19 Nov 2004 12:57:46,586 INFO NewGalleryController:62 - #### model found: com.vvdb.bus.gallery.Model@a262c1
19 Nov 2004 12:57:46,586 INFO NewGalleryController:63 - #### model name null
19 Nov 2004 12:57:46,586 INFO NewGalleryController:62 - #### model found: com.vvdb.bus.gallery.Model@17675
19 Nov 2004 12:57:46,586 INFO NewGalleryController:63 - #### model name null
19 Nov 2004 12:57:46,586 INFO NewGalleryController:62 - #### model found: com.vvdb.bus.gallery.Model@82e1a
19 Nov 2004 12:57:46,586 INFO NewGalleryController:63 - #### model name null
I am using Spring 1.1.
Of course I read this post http://forum.springframework.org/sho...ht=nested+form but I am still stuck, especially because no exception or error is thrown.
Your help is greatly appreciated.
-- Thomas


Reply With Quote