我正在尝试将序列添加为地图中的值:
<#assign client_sequence=['a', 'b']>
{
clients: ${client_sequence},
usecase_key: usecase_value,
other_key: other_value
}
在上面的示例中,client_sequence将从另一个无法更改的模块传递。我已经取代它来说明。
我收到以下错误:
For "${...}" content: Expected a string or something automatically convertible to string (number, date or boolean), or "template output" , but this has evaluated to a sequence (wrapper: f.t.SimpleSequence):
==> client_sequence [在第3行第16栏的无名模板中]
FTL stack trace ("~" means nesting-related):
使用逗号内置的FreeMarker序列的join:
<#assign client_sequence=['a', 'b','c']>
{
clients: ${client_sequence?join(", ")}
usecase_key: usecase_value,
other_key: other_value
}
使用给定的分隔符将序列的项连接到单个字符串。