2
在Java中的特定鍵:檢查如果地圖包含的Freemarker
Map<String, Object> model = new HashMap<>();
Map<String, String> items = new HashMap<>();
items.put("color", "red");
model.put("items", items);
我現在想包括一個片段在我的呈現模板,如果items
包含密鑰color
。
<#if ???? >
the map contains a key called color
</#if>
我怎麼更換????用?
或者,如果鑰匙確實是一個常數,那麼就'items.color ??'。 – ddekany