当前位置: 动力学知识库 > 问答 > 编程问答 >

Freemarker How to pass a HashMap to a TemplateMethodModel

问题描述:

I have a MyMethod class that implements TemplateMethodModel. I need to pass a HashMap to the args of the exec function.

How can I do that from a ftl template ?

FYI I have tried ${myMethod({"key":"value"})} but inside curly brackets are not accepted..

Thanks in advance for your help.

网友答案:

You need to use TemplateMethodModelEx, as TemplateMethodModel converts the arguments to string (it's a legacy...). (You still won't get a HashMap, but a TemplateHashModelEx.)

分享给朋友:
您可能感兴趣的文章:
随机阅读: