[英]StringTemplate rendering map as literal value
Using org.stringtemplate.v4.ST
I am trying to render this template: 我正在尝试使用
org.stringtemplate.v4.ST
渲染此模板:
$if(foo.map)$Foo Map: <foo.map.keys:{k | <k>: <foo.map.(k)>}; separator="\n"><br/>$endif$
When the st.render()
method is invoked, this is printed out: 调用
st.render()
方法时,将其打印出来:
Foo Map: <foo.map.keys:{k | <k>: <foo.map.(k)>}; separator="\n"><br/>
Even though I have set the values in foo.map
they are not printed out. 即使我在
foo.map
设置了值,也不会打印出来。 How do I print the values instead of the template literal? 如何打印值而不是模板文字?
I didn't tried it out. 我没有尝试过。 But on the first view.
但是首先。 Your delimiter is '$' for start and end.
起始和结束的定界符为“ $”。 And not '<', '>'.
而不是“ <”,“>”。 So this should do the trick:
因此,这应该可以解决问题:
$if(foo.map)$Foo Map: $foo.map.keys:{k | $k$: $foo.map.(k)$}; separator="\n"$<br/>$endif$
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.