Spring web flow form binding append to list
I'm learning to use Spring, Spring Webflow and Thymeleaf. I created a little old school wizard application where the user have to fill out some forms click the next button and at the end that was a configuration process. Every view-state
's model is called Configuration
which is my model class. This class contains a List<Note> notes
. On every view-state the user has an option to add some notes. Now my issue is that with the form binding at every view-states this note list will be replaced instead of appended with the new note.
How can i append to this list instead of replace it at every view-state?
Any help is greatly appreciated.
In short: A standard java collections ArrayList is initialized with a FIXED size and cannot be appended to with NEW entries/pojos.
So if you want to bind/append new entries to a collection you need to use the
import org.springframework.util.AutoPopulatingList;
Instead of a standard
java.collections.List
See this answer I wrote on a similar question for more details:
spring webflow submit array with new items
链接地址: http://www.djcxy.com/p/39162.html