pksiv wrote:
This will only work if you have all String/boolean values in your POJO or you can gaurtantee that all type-validation is done using JavaScript since ActionForm validation is done AFTER the fields are populated, and if they user enters char values into a Integer field, you'll get Exceptions thrown.
1. If exception will be thrown or not depends on converter implementation;
2. The same exception will be thrown if there is no validation on Action form;
We have few things to consider:
Approach #A:
Configure validation for on every action form - (good idea but really tedious task);
Then somehow define yet another validation of business object on business layer - that is what we need to do if we follow all the good practices, right? So we have couple of places to do the validation.
Approach #B:
Register custom non throwing converters with ConvertUtils;
Have validation defined for that businass object and reuse it;
Approach #C:
some mix of everything + JScript + trust that in 99.5% cases user will not write letters in numeric field.
By the way with Ajax so hot there should not be problem with JScript enabled on clients.....