Potential Gotcha When Upgrading Spring MVC
If you had a form-backing object with, say, a list of cars, you might have a form item in a JSP like the following:
<form:hidden path="cars.milesPerGallon" />
In prior versions of Spring MVC, this would output:
<input id="cars.milesPerGallon" name="cars.milesPerGallon" type="hidden" value="whatever" />
Note that the array-like syntax is necessary for binding the form data when the user submits the form.
(As an aside, setting the name and the ID to the same value causes problems in older versions of Internet Explorer.)
var elem = document.getElementById('cars.milesPerGallon');
After upgrading to Spring 2.5.x, though, the output differs:
<input id="cars0.milesPerGallon" name="cars.milesPerGallon" type="hidden" value="whatever" />
This change was not done to make the ID and name differ. Instead, square brackets are not allowed in IDs in HTML, as described in http://www.w3.org/TR/html4/types.html#type-name. Spring MVC was changed to correct the IDs. Oddly, you are not supposed to use square brackets in the name attribute either, but the form tags did not change the output of the name attribute.