在Grails中从message.properties获取一些值 [英] Fetching some value from message.properties in Grails

查看:356
本文介绍了在Grails中从message.properties获取一些值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想从作业中的grails中的 message.properties 文件中获取值,我该怎么做?



$ p
$ b

  def execute(){
//执行任务
列表<串GT; emails = NayaxUser.findAllByEmailSent(false)*。username
emails.each {emailAddress->
mailService.sendMail {
// todo:从MESSAGE.PROPERTIES获取
到emailAddress $ b $从FETCH获取从MESSAGE.PROPERTIES
主题从MESSAGE.PROPERTIES获取
html body.toString()
}
}
}


解决方案

您可以使用:

  g.message(code:'my.message。代码')
//或
g.message(code:'my.message.code',args:[arg1,arg2])


Want to fetch a value from message.properties file in grails in a job , how can I do that ??

My Job:

def execute() {
    // execute task
    List<String> emails = NayaxUser.findAllByEmailSent(false)*.username
    emails.each {emailAddress->
        mailService.sendMail {
            //todo: FETCH FROM MESSAGE.PROPERTIES
            to emailAddress
            from FETCH FROM MESSAGE.PROPERTIES
            subject FETCH FROM MESSAGE.PROPERTIES
            html body.toString()
        }
    }
}

解决方案

You can use:

g.message(code: 'my.message.code')
//or
g.message(code: 'my.message.code', args: [arg1, arg2])

这篇关于在Grails中从message.properties获取一些值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆