title: Grails iterating in gsp vs. accessing Map elements
body: <p>Full context:  I'm trying to process multiple files using a grails Application.  The code I will display comes from the post-processing page where it gives information about the files processed.  </p>
  
  <p>My initial sense was to use code like this:</p>
  
  <pre><code>    &lt;table&gt;
        &lt;tr&gt;
          &lt;th&gt;Parsed from Excel:&lt;/th&gt;
          &lt;th&gt;Uploaded to DS:&lt;/th&gt;
          &lt;th&gt;File Name:&lt;/th&gt;
          &lt;th&gt;Size:&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
        &lt;g:each in="${fileContents}" var="item"&gt;
              &lt;td&gt;${item}&lt;/td&gt;
        &lt;/g:each&gt;
          &lt;%-- 
          &lt;td&gt;${fileContents.ExcelRows?.encodeAsHTML()}&lt;/td&gt;
          &lt;td&gt;${fileContents.policies?.encodeAsHTML()}&lt;/td&gt;
          &lt;td&gt;${fileContents.originalFileName?.encodeAsHTML()}&lt;/td&gt;
          &lt;td&gt;${fileContents.Size?.encodeAsHTML()}&lt;/td&gt;
          --%&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
  </code></pre>
  
  <p>Now, what I don't understand is why the contents displayed in the <code>&lt;g:each</code> loop always reports <code>key=value</code> such as <code>ExcelRows=14</code> as I have received in one output case.</p>
  
  <p>When I switch comments (note the <code>&lt;%--</code> tag being used) it works exactly as expected.  From my "<code>ExcelRows</code>" column, I get just "14."  What is wrong with my thinking that the <code>&lt;g:each</code> loop should do the same thing?  Intuitively it comes down to <code>For each item in fileContents
      display item</code>.</p>
  
  <p>My controller code:</p>
  
  <pre><code>def processFile = {
          def uploadedFile = request.getFile('excelFile')
  </code></pre>
  
  <p>//...snipped</p>
  
  <pre><code>        def fileContents = [
              ExcelRows:"${ods.numberOfRows}",
              policies:"${ods.numberOfPolicies}",
              originalFileName: "${ods.originalFilename}", 
              Size:"${ods.size}"
              ]
  
          [fileContents:fileContents]
      }
  </code></pre>