I need to populate in my .jsp file selection from database. As you may see, I build the selection using JQuery (I've created the form earlier and now just append things).
I hoped to use something like this:
<%
// Connection to DB using JDBC
%>
<script>
//JS code here
$form.append('Enter city name: '
+'<select id="location">'
<%
for(i=0;i<rowsNum;i++) {
out.println("+'<option>"+cities.get(i)+" - "+streets.get(i)+"</option>'");
}
%>
+'</select>');
//JS code here
</script>
<%
//Connection close
%>
but it doesn't work. A brief search didn't help much.
Is the problem in this particular part of the code, or it's something else and this part is OK?
Thanks!