I have a list of Animal objects which have attributes name and code. I need to iterate this and display the results in a HTML select where the label has to be name and code has to be value.
Animal
{
  String name;
  String code;
}
I tried to work it out with javascript to push the values in to a select but to no avail. I tried doing the same with c:forEach as well. Does anyone have any idea or clue that can help? Below is the code I was trying to use:
<select id='animalList' multiple="multiple"></select>
var select = document.getElementById("animalList");  
var i = 0;
for (i = 1; i <= 5; i++) {  
  select.options[select.options.length] = new Option(i, i);    
}
 
     
    