In the code below, I am trying to use the var i
in the java method option.value = <% ppList.get(i).getId(); %>
but it is not working out for me very well.
here is the full js function:
function receiveAnswer(response) {
var aSeats = document.getElementById("aSeats");
while (aSeats.childNodes.length > 0) { // clear it out
aSeats.removeChild(aSeats.childNodes[0]);
}
<% List<Physical_Package> ppList = (List<Physical_Package>) session.getAttribute("currentPack"); %>
for (var i = 0; i < 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 = <% ppList.get(i).getId(); %>
}
}