Hello, there is something I don't understand with indexed properties. I have a form backing object representing a "Poll" that contains a List of "Answers". When I'm showing the form I populate it with a number of Answers objects, which results in a number of
in my form. When I'm submitting the form, though, I get an exception like this:
<input type="radio" name="answers.choiceId" value="125" id="response125" />option
org.springframework.beans.InvalidPropertyException : Invalid property 'answers' of bean class [it.esselunga.ecommerce.services.poll.AnsweredPoll]: Index of out of bounds in property path 'answers'; nested exception is java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
I've followed the code and I see that in fact it tries to set the value on my list after creating the form object (which results in an empty list), and without adding it to the list, but directly setting it by index (which causes the error). Does this mean that my only two options are:
1) putting the form in the session on show and reuse it on submit with a correct number of answers
2) leaving the form in the request but receiving a value indicating how many answers must the form have and override formBackingObject so that the form object contains that number of answers?
p.s.: I'm stuck with Spring 1.0.2, for now, maybe this has changed in a later version?