[stringtemplate-interest] Conditional access to Map attribute
Terence Parr
parrt at cs.usfca.edu
Thu Jan 14 14:34:00 PST 2010
weird. that should work fine. You sure it's a Map?
Ter
On Jan 13, 2010, at 10:31 PM, Tommy C. Li wrote:
> Here's basically what I want to do:
>
> $if(metadata.description)$
> <br />
> $metadata.description$
> $endif$
>
> Where "metadata" is a Map passed in. "metadata" may or may not contain
> "description" as a key. If it does not, I hope to have it print nothing.
>
> Right now I get:
>
> Class com.keepword.render.MyJCL$$anon$1 has no such attribute:
> description in template context [short]
> java.lang.NoSuchFieldException: description
>
> What's the proper way to accomplish this in ST?
>
> Tommy
>
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
More information about the stringtemplate-interest
mailing list