Grails Problem with custom error messages

后端 未结 5 848
庸人自扰
庸人自扰 2021-02-05 16:30

I am currently trying to specify custom error messages in grails for the default constraints but so far all I get back is the default error message.

I know that I have t

5条回答
  •  名媛妹妹
    2021-02-05 17:28

    put def messageSource (in controller or service)

    item.errors?.allErrors?.each{ 
    println  messageSource.getMessage(it, null)
    };
    

    I also found a good link which explains this better

    http://johnrellis.blogspot.com/2010/02/retrieve-grails-domain-errors-from.html

提交回复
热议问题