title: Free Marker: freemarker.core.InvalidReferenceException
body: <p>I use freemarker templates and i have given the code within the ftl file below.</p>
  
  <pre><code>&lt;#if (actionErrors?exists &amp;&amp; actionErrors?size &gt; 0)&gt;
      &lt;ul&gt;
      &lt;#list actionErrors as error&gt;
          &lt;li&gt;&lt;span&lt;#rt/&gt;
  &lt;#if parameters.cssClass?exists&gt;
   class="${parameters.cssClass?html}"&lt;#rt/&gt;
  &lt;/#if&gt;
  &lt;#if parameters.cssStyle?exists&gt;
   style="${parameters.cssStyle?html}"&lt;#rt/&gt;
  &lt;/#if&gt;
  &gt;${error}&lt;/span&gt;&lt;/li&gt;
      &lt;/#list&gt;
      &lt;/ul&gt;
  &lt;/#if&gt;
  </code></pre>
  
  <p>The above code gives the following error.</p>
  
  <blockquote>
    <p>freemarker.core.InvalidReferenceException: Expression error is
    undefined on line 33</p>
  </blockquote>
  
  <p>I wrapped the ${error} with &lt;#if error.value??> and tried again. Still it gave the same issue. Then i used the ${error.value!'N/A'} as mentioned <a href="https://stackoverflow.com/questions/11577482/freemarkers-skip-assertnonnull-invalidreferenceexception">here</a>. Still it didn't resolve the issue. Please help me with this.</p>
  
  <p>Thank you in advance. </p>
  
  <p>Thank you.</p>