I am developing one web based application where I have one list and one dependent textbox. I have added customer names in list. I want customer id to be filled in textbox when I will select customer name in list. I have tried using javascript function but that only helps me to know customer name.
Customer Id is not value of option tag its customer code which I have entered while registration of customer. So I want to fetch customer code from mysql database.
Can any one please suggest me something? This is my jsp code.
<% DBConnection dbc=new DBConnection();
Connection con=dbc.getNewConnection();
Statement st = null;
ResultSet rs = null;
try
{
st=con.createStatement() ;
rs=st.executeQuery("select cname from CustomerMaster");
%>
<td>
<select id="selectBox" >
<% while(rs.next()){ %>
<option ><%= rs.getString(1)%></option>
<% } %>