JSR-303 Type Checking Before Binding

旧城冷巷雨未停 提交于 2019-11-27 19:52:53

As you mentioned, you need a user-friendly message in messages.properties. You can use one of the following message codes (with different levels of selectivity):

  • typeMismatch.section.value
  • typeMismatch.value
  • typeMismatch.int
  • typeMismatch

Also, when you don't know message code, you can simply print the BindingResult - its toString() returns the full description of the binding errors.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!