Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Binding collections to Spring form

 
Vyas Sanzgiri
Ranch Hand
Posts: 686
Chrome Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to bind a collection of values to Spring form but I get the following error. I tried to do it with LazyList but still the same issue. Any pointer to the correct article which can help me get started?

javax.servlet.ServletException: org.springframework.beans.InvalidPropertyException : Invalid property 'parameters[0]' of bean class [beans.Input]: Index of out of bounds in property path 'parameters[0]'; nested exception is java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The list must have at least one data (index 0).
 
Vyas Sanzgiri
Ranch Hand
Posts: 686
Chrome Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It has information but the binding is not working. List has more than 1 element in my test case
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should try to debug then, it tried to access something that has no data in list.
 
Vyas Sanzgiri
Ranch Hand
Posts: 686
Chrome Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand that !! but I am not able to figure out. I tried to debug but I do not want to go under the covers into Spring framework.
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vyas Sanzgiri wrote:I understand that !! but I am not able to figure out. I tried to debug but I do not want to go under the covers into Spring framework.

When you debug, you're supposed to debug in Spring Framework code to see what actually happens.
 
Vyas Sanzgiri
Ranch Hand
Posts: 686
Chrome Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not want to debug the Spring framework code. I would rather concentrate on my business logic
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're not debugging Spring framework code - it's not just magically losing values - you're debugging how *you're* using Spring framework code.
 
Vyas Sanzgiri
Ranch Hand
Posts: 686
Chrome Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Figured it out http://www.coderanch.com/t/61337/Spring/Binding-with-ArrayList-Spring#2041973
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic