Description
Dmitry Platonov opened SPR-4728 and commented
There's a popular use case (search forum for 'dynamic list') for implementing dynamic lists on web pages.
The most common approach is to create hacks in controller to initialize collections/arrays command object properties before binding - trim or grow collections/arrays properties to some calculated size. This will allow binder to bind props[0].name, props[1].name request params to command object even if original command.getProps() returns null or empty collection/array.
The approach must be used EACH controller which wants to work with dynamically added fields.
This could be fixed in SINGLE place - in BeanWrapperImpl#getPropertyValue(), which could allow collection/array to grow instead of simply (Array.get(value, Integer.parseInt(key)), list.get(Integer.parseInt(key)))
Or could we somehow override that method?
Affects: 2.5.3
Issue Links:
- Option to expose empty value instead of NullValueInNestedPathException [SPR-1671] #6368 Option to expose empty value instead of NullValueInNestedPathException
- Data Binder: Auto-grow collections as needed to support nested property binding [SPR-6033] #10702 Data Binder: Auto-grow collections as needed to support nested property binding
7 votes, 9 watchers