Displaying Spring MVC validation errors in Freemarker templates

前端 未结 4 1195
终归单人心
终归单人心 2021-01-06 14:29

I\'m trying to display a list of global validation errors in my freemarker template if a controller returns binding errors. I can display errors that are associated with a f

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-06 14:47

    You can write as follows:

    <#if spring.status.error>
    
      <#list spring.status.errors.globalErrors as error>
    • ${error.defaultMessage}

    More info at BindStatus and Errors classes.

提交回复
热议问题