title: Call a Javascript function from jstl foreach
body: <p>I am iterating over a list in JSTL to show its records. There is <code>onclick=&quot;editList()&quot;</code> event on each <code>&lt;form:label</code>. I want to send both <code>${item.id}</code> and <code>${item.number}</code> in the <code>editList()</code> function parameters if any of them is clicked. How can I send these parameters.</p>
  <pre><code>&lt;c:forEach var='item' items='${rule.list}' varStatus=&quot;itemsRow&quot;&gt;
   &lt;tr&gt;
      &lt;form:label path=&quot;list[${itemsRow.index}].id&quot; onclick=&quot;editList()&quot;&gt;
       ${item.id}
      &lt;/form:label&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
      &lt;form:label path=&quot;list[${itemsRow.index}].number&quot; onclick=&quot;editList()&quot;&gt;
       ${item.number}
      &lt;/form:label&gt;
   &lt;/tr&gt;
  &lt;/c:forEach&gt;
  </code></pre>