我正在使用句柄模板在发送之前动态地准备电子邮件内容。Java:将多个值传递给句柄模板
只传递一个值很简单。例如:
What's up {{this}}
模板工作正常template.apply(firstName)
。
尝试将模板更改为What's up {{this}}, {{this}}
并尝试填写template.apply(lastName);
和template.apply(firstName);
。
但它不起作用。
我正在使用句柄模板在发送之前动态地准备电子邮件内容。Java:将多个值传递给句柄模板
只传递一个值很简单。例如:
What's up {{this}}
模板工作正常template.apply(firstName)
。
尝试将模板更改为What's up {{this}}, {{this}}
并尝试填写template.apply(lastName);
和template.apply(firstName);
。
但它不起作用。
您必须通过名称引用您在this
对象上设置的变量。
What's up {{firstName}}, {{lastName}}
传递一个map作为参数。
template.hbs
What's up {{firstName}}, {{lastName}}
controll.java
template.apply(new HashMap<String, Object>() {
{
put("firstName", "Himanshu");
put("lastName", "Yadav");
}
});
'handleBar'不工作的方式。你介意一点点阐述你的回答吗? –
是handlebars.java与handlebars.js有什么不同? –