hI fRIENDS i HAVE A PROBLEM WHILE DOING JSP CODING.i HAVE A jSP CODE WHICH CONSISTS OF A DROP DOWN LIST .iF I SELECT A LIST ITEM I SHOULD DISPLAY CORRESPONDING VALUES FROM MYSQL DATABSE IN ANOTHER DROP DOWN lIST hOW TO SELECT A DROP DOWN lIST ITEM
Joined: Jan 14, 2004
Give the function selectCombo() in the onChange() attrirbute of the combo box. From the servlet you can access the hidden fields value Using this as the parameter you can execute ur sql command , get the record set , populate a vector or an ArrayList and return to your JSP with the values so as to populate the next combo with these values....
Hope I have not complicated things... Cheers! Menon
document.formName.hiddenField.value= document.formName.comboBox.value; ......... From the servlet you can access the hidden fields value Using this as the parameter you can execute ur sql command , get the record set .........
Arundhathi, Pls dont mind my asking, but wouldnt it be a easier soln to get the data from the combo itself. I mean in the servlet, I can access the value of the comboBox field itself, y assign the value to a hidden field, and then read its value ? Isnt it kinda roundabout ? I think what she wants is she has a list of 2 items and on selecting one, the other should be displayed. It may mean that she already has the set of data and on clicking one list, the value should be populated in the other. She has already posted this in the jsp forum and I replied to that based on my assumption above. So Dolly, can u come up with what u require precisely ? ram.