in velocity can you iterate through a java hashmap’s entry set()?

Your mistake is referring to key and value as methods (with trailing “()” parenthesis) instead of as properties. Try this: #set ($map = $myobject.getMap() ) #foreach ($mapEntry in $map.entrySet()) <name>$mapEntry.key</name> <value>$mapEntry.value</value> #end In other words, use either a property, like mapEntry.key, or the method, like mapEntry.getKey().

$null check in velocity

To check if a variable is not null simply use #if ($variable) #if ($variable) … do stuff here if the variable is not null #end If you need to do stuff if the variable is null simply negate the test #if (!$variable) … do stuff here if the variable is null #end