title: Displaying java list content using JSTL per table row
body: <p>I'm having trouble with displaying data in an html table using java jstl. I'm hoping someone has done this before and can offer guidance or an example. </p>
  
  <p>This is how the table(rows, data) is currently displaying :</p>
  
  <pre><code>Apple, Orange, Mange
  100, 101, 102
  200, 201, 202
  300, 301, 302
  </code></pre>
  
  <p>But this is how I actually need it to display</p>
  
  <pre><code>Apple, 100, 200, 300
  Orange, 101, 201, 301
  Mango, 102, 202, 302   
  </code></pre>
  
  <p>This is my current JSTL display code</p>
  
  <pre><code>&lt;c:forEach items="${dataSetList}" var="currentDataSetObj"&gt;
      &lt;tr&gt;
       &lt;c:forEach items="${currentDataSetObj.myList}" var="currentValueOfDataElement" varStatus="loopCount" &gt;
            &lt;td&gt;  &lt;c:out value="${currentValueOfDataElement}" /&gt;  &lt;/td&gt;
       &lt;/c:forEach&gt;
       &lt;/tr&gt;
  &lt;/c:forEach&gt;
  </code></pre>
  
  <p>And this is the server code</p>
  
  <pre><code>public class DataSet {
      List&lt;String&gt; myList = new ArrayList&lt;String&gt;();
      // more stuff not relevant to question here
  }
  
  List&lt;DataSet&gt; dataSetList = new ArrayList&lt;DataSet&gt;();
  DataSet dataSetOne   = new DataSet();
  DataSet dataSetTwo   = new DataSet();
  DataSet dataSetThree = new DataSet();
  DataSet dataSetFour  = new DataSet();
  
  List&lt;String&gt; fruitA = new ArrayList&lt;String&gt;();
  List&lt;String&gt; priceA = new ArrayList&lt;String&gt;();
  List&lt;String&gt; priceB = new ArrayList&lt;String&gt;();
  List&lt;String&gt; priceC = new ArrayList&lt;String&gt;();
  
  fruitA.add("Apple");
  fruitA.add("Orange");
  fruitA.add("Mango");
  priceA.add("100");
  priceA.add("101");
  priceA.add("102");
  priceB.add("200");
  priceB.add("201");
  priceB.add("202");
  priceC.add("300");
  priceC.add("301");
  priceC.add("302");
  
  dataSetOne.setMyList(fruitA);
  dataSetTwo.setMyList(priceA);
  dataSetThree.setMyList(priceB);
  dataSetFour.setMyList(priceC);
  
  dataSetList.add(dataSetOne);
  dataSetList.add(dataSetTwo);
  dataSetList.add(dataSetThree);
  dataSetList.add(dataSetFour);
  
  request.setAttribute("dataSetList", dataSetList);
  </code></pre>