Skip to content

mvc: Dynamic List use case - allow collections/arrays to grow [SPR-4728] #9405

Closed
@spring-projects-issues

Description

@spring-projects-issues

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:

7 votes, 9 watchers

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: duplicateA duplicate of another issuetype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions