Skip to content

form:select 3.0.1 regression bug when binding to a map [SPR-7040] #11702

@spring-projects-issues

Description

@spring-projects-issues

Jeff Johnston opened SPR-7040 and commented

I found a bug that surfaced in Spring 3.0.1. The problem is with binding a value to a map with the form select tag.

In my JSP I have the following select tag. This will bind to a Map<String, String> field in my command object.

<form:select path="questions[${question.key}]" cssClass="${question.key}" items="${question.answers}" itemValue="key" itemLabel="name"/>

If I do a view source I can clearly see the problem.

In Spring 3.0 I have this:

<select id="questionsARTISAN_ARMOIRE_WOOD" name="questions[ARTISAN_ARMOIRE_WOOD]" class="ARTISAN_ARMOIRE_WOOD"><option value="001" selected="selected">Cherry</option><option value="002">Walnut</option></select>

In Spring 3.0.1 I have this:

<select id="questionsARTISAN_ARMOIRE_WOOD" name="questionsARTISAN_ARMOIRE_WOOD" class="ARTISAN_ARMOIRE_WOOD"><option value="001" selected="selected">Cherry</option><option value="002">Walnut</option></select>

Notice how the name is "questionsARTISAN_ARMOIRE_WOOD" instead of "questions[ARTISAN_ARMOIRE_WOOD]". The brackets got dropped in 3.0.1.


Affects: 3.0.1

Issue Links:

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: duplicateA duplicate of another issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions