提问人:yosr ben daly 提问时间:9/20/2023 更新时间:9/20/2023 访问量:21
速度模板 - 消息键 #msg
Velocity template - message key #msg
问:
我有电子邮件模板 .vm,其中包含带有来自 messages_en.properties 的消息密钥的 msg:
#msg("email-ePwdReminder-salutation")
并创建了 Velocity 上下文,如下所示:
VelocityContext context = new VelocityContext();
context.put("email-ePwdReminder-salutation",messageSource.getMessage("email.ePwdReminder.salutation",null,locale));
Merge the template with the context to generate the HTML body
StringWriter writer = new StringWriter();
Replace with logic to fetch the correct template
Template template = velocityEngine.getTemplate(templateName);
template.process();
template.merge(context, writer);
String htmlBody = writer.toString();
#msg 似乎不是速度引擎的预定义指令,那么我该如何创建自定义指令 #msg 并能够替换电子邮件模板中的 email.ePwdReminder.salutation 变量。
答: 暂无答案
上一个:如何转换加速度和速度
下一个:Velocity 模板字符串串联
评论