I am currently using jsp and I wanted to create a dynamic drop down list. When the page first loads I have this drop down list:
<select name="target" id="target">
<option value="">--Select an option--</option>
<option value="add">Add a client with a program</option>
<option value="exit">Mark a client as exit client</option>
<option value="refuse">Refuse a client</option>
</select>
If on a user changes the value of the drop down and the value is add then I would like to execute the following query in my jsp page:
String query = "SELECT * FROM CLIENT ORDER BY CID DESC";
ResultSet result = s.executeQuery(query);
while(result.next()) {
out.print("<option value=" + result.getString("CID") + ">");
out.print(result.getString("Name") + " (" + result.getString("CID")+")");
out.print("</option>\n");
}
if the user choose's exit then a different query is executed, how can I do this? Basically what I want from the jQuery perspective is so it can change the query
value on an onChange event on the select option and run executeQuery