title: Assigning a variable to an object in Freemarker templates
body: <p>I am trying to avoid repeatedly refering to objects like this:</p>
  
  <pre><code>${outter.inner.assignThisGuy.field1}
  </code></pre>
  
  <p>and would like to refer to lowest level, i.e. </p>
  
  <pre><code>${assignThisGuy.field1}
  </code></pre>
  
  <p>This will help me remove repeated null checks and make my template tidier.  I'm not sure if this is possible. All the notes refer to assigning a variable to a type like ?string, ?date, etc. </p>
  
  <p>When I try to do it I get an exception:</p>
  
  <pre><code>freemarker.template.TemplateException: Expected hash. thisGuy evaluated instead to freemarker.template.SimpleScalar 
  </code></pre>
  
  <p>I have tried variations on:</p>
  
  <pre><code>[#assign thisGuy = "${outter.inner.assignThisGuy}" ]
  </code></pre>
  
  <p>I just want to be sure this is not possible before some of my lines become massive in length!</p>