PDA

View Full Version : Spring Binding



cheenu78
Sep 12th, 2005, 07:42 AM
hi All

I have a model like the followiing:

public class TestModel {

private List mylist;//this inturn contains a list of DataObject
//and one of the variables in the DataObject is a list again


public List getMylist() {
return mylist;
}

public void setMylist(List list) {
this.mylist = list;
}
}

All the normal variables in the Data Object are getting bounded except for the list iin the dataobject automatically.

eg:
This code comes in a forEach:

<input type="text" name="list[${cntr.count-1}].name" value="${list.name}"/>

the above binds well

but... the below does not bind:

<input type="text" name="list[${cntr.count-1}].sList[0]" value="${list.sList[0]}" />

Can anyone tell me where I am going wrong?
Thanks in advance
Srinivas

Colin Yates
Sep 12th, 2005, 08:01 AM
Can you print out the stack trace please ;)

Are you certain that getSList() on the nested bean returns an a non-empty array?

cheenu78
Sep 12th, 2005, 08:29 AM
hi,
While displaying the value gets fetched but while submitting the form the values does not get bound. It happens only for the nested list, The name gets bound properly.
There are no errors.
Thanks in advance
srinivas

Colin Yates
Sep 13th, 2005, 06:39 AM
Can you please post your full backing object (wrapped in the code tags), controller, jsp and *rendered jsp*.