问题终于解决了: Have the customized typeMismatch message in your message properties file that Spring load as messageResource.Example: # For generic error message on type mismatch Date typeMismatch.java.util.Date={0} is an invalid date.# For specific error message on perticular form field # (e.g. startDt is a form field name) typeMismatch.startDt=Start Date is an invalid date.
上面二位的回答,貌似不太理想!
User类是一个pojo,我们用了 hibernate
Have the customized typeMismatch message in your message properties
file that Spring load as messageResource.Example:
# For generic error message on type mismatch Date
typeMismatch.java.util.Date={0} is an invalid date.# For specific error message on perticular form field
# (e.g. startDt is a form field name)
typeMismatch.startDt=Start Date is an invalid date.