PDA

View Full Version : MySQL query has to display in dropdown button in jsp


Amit_Patil
Jun 4, 2010, 12:19 AM
MySQL query result has to display in drop-down button in jsp.

dandemeyere
Aug 3, 2010, 04:20 PM
Well I'm not sure about the actual JSP code used to do this. But when you retrieve your MySQL result and store it in an array, iterate through the array and at every instance, create a new drop-down item.
Pseduocode:

<select>
<!-- JSP code starts here -->
arrReturn = query(result);
for(int i=0; i < arrReturn.length(); i++) {
echo '<option value="' . i . '">' . arrReturn[i] . '</option>';
}
<!-- End JSP code -->
</select>