Below is my code,
<select name = "department_select">
<script language = "javascript" type="text/javascript">
var dept_names = [];
var index=0,limit,it;
<%
String dept_list[] = dbManager.get_dept_list();
for(int i=0;i<dept_list.length;i++)
{
%>
dept_names[<%=i%>] = <%=dept_list[i]%>;
<%
}
%>
limit = dept_list.length;
for(index=0;index<limit;index++)
{
document.write("<option>"+dept_names[index]+ "</option>");
}
</script>
</select>
I am trying to create a dropdownlist that will access the data from the database and use those data as options of the dropdownlist in the jsp page for a few days now.
When my jsp page is executed it shows the dropdownlist, but there is no option, just blank.
I think assignment at line 10 of the code is not working.
I tried to assign each value of the java array to the javascript array using a loop.
Why this is not working ? I am using oracle database system.