Description
Stefan Schmidt opened SPR-6491 and commented
Problems arise when using MVC form-objects are bound through the data binder when the fields use 'unusual' capitalizations:
class Book {
String Title;
String ISBN;
int nInStock;
public String Book.getTitle() { ... }
public void Book.setTitle(String Title) { ... }
public String Book.getISBN() { ... }
public void Book.setISBN(String ISBN) { ... }
public int Book.getNInStock() { ... }
public void Book.setNInStock(int nInStock) { ... }
}
Only the following representation of these fields in a MVC form works:
<form:input path="title" />
<form:input path="ISBN" />
<form:input path="NInStock" />
Note, the Title needs to be lowercased whereas ISBN needs to remain uppercase (ie iSBN raises a NotReadablePropertyException). Same for the nInStock field which needs to be uppercased (first letter) and nInStock would raise a NotReadablePropertyException).
This seems to be inconsistent w/r to the conventions used here. Why is title handled different to the other two? Also, why can't we allow a convention where title, iSBN and nInStock all work assuming that the get methods follow JavaBean conventions with correct accessors and mutators as shown above? The data binder would just uppercase the first letter of the form field and prepend get and set accordingly.
Maybe I am missing a pattern here but this seems to be handled very inconsistently.
Affects: 3.0 RC3
Issue Links:
- ROO-446 Uppercase domain properties are not used correctly in views ("is depended on by")
- Spring Framework fails to find bean property if the setter contains more than one capital after the word set (e.g., setTEmailAddr) [SPR-7388] #12046 Spring Framework fails to find bean property if the setter contains more than one capital after the word set (e.g., setTEmailAddr)
Referenced from: commits 388edd7