How To Submit The Option Selected From Drop Down List In Jsp Page To Perform A Mysql Query
My project is StaffAllocation, and I want to retrieve information from the database. I'm very new and this is my very first project. I created a drop down list retrieving staffname
Solution 1:
I have fiddled sample implementation for your reference. You can implement like that. All you need to do is include jQuery plugin. Sample code lke this,
$.ajax({
url : 'ur_servlet_url' + selValue,
type : "POST",
async : false,
success : function(data) {
//Sample datavar data = "<select id='child'>
<option value='11'>Value11</option></select>"
$("#fillValue").html(data);
}
});
You need to compose your java response like select tag and return it to your ajax response. Finally you can fill the second dropdown like that. Let me know if this helps.
Solution 2:
<form method="post" action="select.jsp">
<selectname="sell"><optionvalue="Alto">Alto</option><optionvalue="Esteem">Esteem</option><optionvalue="Honda City">Honda City</option><optionvalue="Chevrolet">Chevrolet</option></select>
<br>
<inputtype="Submit"value="Submit"></form>
<%
String st=request.getSelectedIndex("sell");
if(st!=null){
out.println("You have selected: "+st);
}
%>
Post a Comment for "How To Submit The Option Selected From Drop Down List In Jsp Page To Perform A Mysql Query"