Grails - getting a message value from controller

后端 未结 2 404
旧巷少年郎
旧巷少年郎 2020-12-08 00:49

How can I get a value from message properties outside of GSPs? For instance, the equivalent of


but

2条回答
  •  抹茶落季
    2020-12-08 01:30

    You can also import the validation tag lib and use it grab the message source.

    import org.codehaus.groovy.grails.plugins.web.taglib.ValidationTagLib
    def g = new ValidationTagLib()
    g.message(error: error)
    

提交回复
热议问题