Spring - adding BindingResult to newly created model attribute

梦想与她 提交于 2019-11-30 08:15:18

Skaffman answered the question but disappeared, so I will answer it for him.

The binding validation thing is there to bind and validate parameters, not arbitrary business objects.

That means, that if I need to do some custom validation of some general data that was not submitted by the user - I need to add some custom variable to hold that status and not use BindingResult.

This answers all the questions I had with BindingResult, as I thought it had to be used as a container for any kind of errors.

Again, thanks @Skaffman.

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