Call setter-method for array when binding model data [SPR-17472] #22004
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: declined
A suggestion or change that we don't feel we should currently apply
Patrik Starck opened SPR-17472 and commented
Problem
This is an issue concerning when you bind data for a model, for example when submitting a form with a modelAttribute bound to it. If the item to be set is of a multidimensional type, the setter of the property will never be called.
Consider the following code:
And the corresponding JSP-page:
When submitting the form, the "setName" is be called, but not the "setProductImageList".
I don't think this is intened?
Proposed Solution
The problem occurs in the class AbstractNestablePropertyAccessor in function processKeyedProperty. When using an array/list/vector or other multi-dimensional container, the function doesn't call the write method for the current PropertyHandler.
A fix would be to add this line of code
after this line
Then one would apply the same approach for "Map" and "Array" as well which is defined in the same function.
Affects: 5.1.2
The text was updated successfully, but these errors were encountered: