Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-7040

form:select 3.0.1 regression bug when binding to a map

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 3.0.1
    • Fix Version/s: None
    • Component/s: Web
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                juergen.hoeller Juergen Hoeller
                Reporter:
                jeff.johnston.mn Jeff Johnston
                Last updater:
                Trevor Marshall
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  8 years, 34 weeks, 5 days ago