This is necessary because you may need to bind multiple checkboxes to one field, and each of them must have a unique identifier.
For example, if your form object has a list of interests
Programming: <form:checkbox path="interests" value="Programming"/>
Painting: <form:checkbox path="interests" value="Painting"/>
Fishing: <form:checkbox path="interests" value="Fishing"/>
The output will be:
Programming: <input id="interests1" name="interests" type="checkbox" value="Programming"/>
Painting: <input id="interests2" name="interests" type="checkbox" value="Painting"/>
Fishing: <input id="interests3" name="interests" type="checkbox" value="Fishing"/>
(I missed the hidden empty value input)
source
share