sqldoug
sqldoug

Reputation: 409

Exposing all the globals in FreeMarker

<#list .globals?keys as vals>
${vals}
</#list>


FreeMarker template error: For "?keys" left-hand operand: Expected an extended
hash, but this has evaluated to a hash (wrapper: f.c.Environment$4):
==> .globals  [in template "contents/globals.ftl" at line 9, column 8]

In other words, how to render the keys of a hash which is not extended in FreeMarker? (I'm using node.js with fmpp, rather than developing in Java)

Upvotes: 1

Views: 841

Answers (1)

Lars Gendner
Lars Gendner

Reputation: 1982

As already stated in the comments, the keys of globals are not accessible. globals are a hash and no extended hash. This means, you can not access their keys and values using the built-ins for hashes.

You can tell if a hash is extended (and thus supports those built-ins) by using is_hash_ext.

Upvotes: 1

Related Questions