title: core:forEach in javascript
body: <p>I have this code to display details from database to jsp. I'm using core:forEach to sort through the list of results.But now inorder to simplify jsp code I'm implementing the core:forEach in javascript.And I'm displaying the results in a dynamically created table. But now while using core:forEach in javascript, only the last value in the list is getting displayed. Code is as follows.</p>
  
  <pre><code>window.onload = function CreateTable()
  {
      &lt;core:forEach items="${requestScope.projectWiseDetails}" var="row"&gt;;  //first list sorting based on project name
        var tablecontents = "";
        tablecontents = "&lt;table&gt;";             //dynamic table
        tablecontents += "&lt;tr&gt;";
        tablecontents += "&lt;td&gt;" + "Resource Name" + "&lt;/td&gt;";
        tablecontents += "&lt;/tr&gt;";
          &lt;core:forEach items="${row.onsite3to5YearsList}" var="resource"&gt;     //second sorting which comes under project name
            tablecontents += "&lt;tr&gt;";
            tablecontents += "&lt;td&gt;" +&lt;core:out value="${resource.resourceName}"&gt;&lt;/core:out&gt;+ "&lt;/td&gt;";
          &lt;/core:forEach&gt; 
       tablecontents += "&lt;/tr&gt;";
       tablecontents += "&lt;/table&gt;";
    &lt;/core:forEach&gt;
    document.getElementById("tablespace").innerHTML = tablecontents;     //attaching the table to an element
  
  
  }
  
  
   &lt;p id="tablespace"&gt;&lt;/p&gt;  //This is where the table gets generated
  </code></pre>