title: How to extract each field from the object in JSP file?
body: <p>I have a class which contains three list string as mentioned below - </p>
  
  <pre><code>public class Response {
  
  private List&lt;String&gt; hash = new LinkedList&lt;String&gt;();
  private List&lt;String&gt; name = new LinkedList&lt;String&gt;();
  private List&lt;Integer&gt; count = new LinkedList&lt;Integer&gt;();
  
  // getters and setters
  }
  </code></pre>
  
  <p>Now I have a servlet from which I putting values in my Response object as shown below - </p>
  
  <pre><code>Response rr = new Response();
  
  rr.setName(Arrays.asList("Test1", "test2", "Test3"));
  rr.setHash(Arrays.asList("Test4", "Test5", "Test6"));
  rr.setCount(Arrays.asList(0, 1, 2));
  </code></pre>
  
  <p>Now from that same servlet only, I am passing the above object values to my JSP page as mentioned below - </p>
  
  <pre><code>req.setAttribute("data", rr);
  final RequestDispatcher dispatcher = req.getRequestDispatcher("/admin/testing.jsp");
  dispatcher.forward(req, resp);
  </code></pre>
  
  <p>And below is my JSP page in which I am getting the value of that same object successfully. In the below JSP page, I am trying to extract the value of each field and putting it in its respective columns in the table - </p>
  
  <p>Meaning, I have three columns in the below table in my JSP, first is <code>Hash</code>, second is <code>Name</code> and third is <code>Count</code>. Now I need to extract all the  value of hash from that object in Hash column, and similarly extract all the value of name from that object in Name column and etc.</p>
  
  <pre><code>&lt;p&gt;The data from servlet: ${data}&lt;/p&gt;
  
  &lt;TABLE BORDER="1" CELLPADDING="3" CELLSPACING="1"&gt;
  &lt;TR&gt;
  &lt;TH&gt;Hash&lt;/TH&gt;
  &lt;TH&gt;Name&lt;/TH&gt;
  &lt;TH&gt;Count&lt;/TH&gt;
  &lt;/TR&gt;
  &lt;% for (int i = 0; i &lt; 3; i++) { %&gt;
  &lt;TR&gt;
  &lt;TD&gt;
  ${data.getHash().get(&lt;%=i%&gt;)}
  &lt;/TD&gt;
  &lt;TD&gt;
  ${data.getName().get(&lt;%=i%&gt;)}
  &lt;/TD&gt;
  &lt;TD&gt;
  ${data.getCount().get(&lt;%=i%&gt;)}
  &lt;/TD&gt;
  &lt;/TR&gt;
  &lt;% } %&gt;
  &lt;/TABLE&gt;
  </code></pre>
  
  <p>But everytime, it is giving me this exception - </p>
  
  <pre><code>interpolated runtime values are forbidden by
  the JSP spec at '${data.getHash().get(&lt;%=i%&gt;)}'
  </code></pre>
  
  <p>Any idea what wrong I am doing? And how can I extract all the fields values from that object in my table?</p>
  
  <p>Currently, all my three list in Response class will have only 3 elements.</p>
  
  <p>Final output will look like - </p>
  
  <p>In the table, Hash column will have three data inside it, Name column will have three data inside it, Count column will have three data inside it..</p>