Showing posts with label spring bind list indexed property. Show all posts
Showing posts with label spring bind list indexed property. Show all posts

Tuesday, April 14, 2009

Bind indexed properties in Spring

You can use sping:bind to bind indexed properties. This only works with ordered collection such as List, but not Set.



Here are a few things to note.
  1. The syntax of "path=ingredientDtos[${rowId.index}].baselineDate" - this tells Spring to bind these to a list. If you use "c:out" instead of "form:input" or "form:hidden", then the field will not be submitted and bound
  2. Only the fields listed here in this syntax are submitted and bound. For example, if ingredient has a property called "company" and it is not added here with form:input or form:hidden. Then you will find the property is null in onSubmit(). So the object might miss properties unless they are all listed and bound.