What is the use of BindingResult interface in spring MVC?

前端 未结 6 1072
梦如初夏
梦如初夏 2020-12-12 18:43

Is BindingResult useful to bind just exceptions with view, or something else?

what is the exact use of BindingResult?

Or is it usef

6条回答
  •  萌比男神i
    2020-12-12 19:25

    Well its a sequential process. The Request first treat by FrontController and then moves towards our own customize controller with @Controller annotation.

    but our controller method is binding bean using modelattribute and we are also performing few validations on bean values.

    so instead of moving the request to our controller class, FrontController moves it towards one interceptor which creates the temp object of our bean and the validate the values. if validation successful then bind the temp obj values with our actual bean which is stored in @ModelAttribute otherwise if validation fails it does not bind and moves the resp towards error page or wherever u want.

提交回复
热议问题