How do I get an int variable in javascript to input in a java method
<p>In the code below, I am trying to use the <code>var i</code> in the java method <code>option.value = &lt;% ppList.get(i).getId(); %&gt;</code> but it is not working out for me very well. </p>

<p>here is the full js function:</p>

<pre><code>function receiveAnswer(response) {
  var aSeats = document.getElementById("aSeats");
  while (aSeats.childNodes.length &gt; 0) { // clear it out
    aSeats.removeChild(aSeats.childNodes[0]);
  }
  &lt;% List&lt;Physical_Package&gt; ppList = (List&lt;Physical_Package&gt;) session.getAttribute("currentPack"); %&gt;
  for (var i = 0; i &lt; response.aSeats.length; i++) { // add the items back in
    var option = aSeats.appendChild(document.createElement("option"));
    option.setAttribute("type", "hidden");
    option.setAttribute("name", "id");
    option.setAttribute("value", "")
    option.appendChild(document.createTextNode(response.aSeats[i]));
    option.value = &lt;% ppList.get(i).getId(); %&gt;
  }
}
</code></pre>
