title: Freemarker - default value for variable that may be missing or blank?
body: <p>In Freemarker, I want to treat something that may be missing (not defined on given object or in given <code>Map</code>), have a <code>null</code> value, be an empty string <code>""</code> or a string with whitespace only (<code>" \t\n"</code>), AKA blank string. Or a real value like <code>"foo"</code>.</p>
  
  <p>In case it's anything besides a non-blank string, I want the expression to return a default value. </p>
  
  <p>How can I handle this in Freemarker?</p>
  
  <p>So far, this is what I use:</p>
  
  <pre><code>${ obj.propery???then(obj.property?trim!"default") }
  </code></pre>
  
  <p>But I can imagine something more ellegant, like</p>
  
  <pre><code>${ obj.property!!?trim!"default" }
  </code></pre>
  
  <p>and even with trimming (which is quite common operation for templates):</p>
  
  <pre><code>${ obj.property!!!"default" }
  </code></pre>
  
  <p>Is there something such in Freemarker? (Besides coding my own method or macro.)</p>