Where you can populate it on the serverside. By that I mean that when you create the select box on your JSP, populate it then. For example:
<select id="sel1" name="animal">
<c:forEach var="animal" items="${model.animals}">
<option value="<c:out value="${animal.id}"/><c:out value="${animal.name}"/></option>
</c:forEach>
</select>
If that isn't possible, practical or desired, you'll need to use some form of AJAX method. Personally I use jQuery for this. For example:
<select id="sel1" name="animal">
</select>
<script type="text/javascript">
$(function() {
$.get('/server/getanimals', function(data, textStatus) {
var sel = $("#sel1");
for (var i=0; i<data.length; i++) {
sel.append('<option value="' + data[i].id + '">' + data[i].name + '</option>');
}
}, 'json');
});
</script>
The above calls /server/getanimals
on page ready. It is expecting to be returned a JSON object with a list of animals that it then uses to populate the select box.
There are lots of ways to skin this particular cat.