Using org.stringtemplate.v4.ST
I am trying to render this template:
$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:
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. 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$
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.