jsp 两个关联下拉列表,从数据库取值,如何依据选择的下拉列表值,查询数据库中相应的数据,在文本框中显示。菜鸟求教
代码如下:  <tr>
    <td align="center">物料种类</td>
    <td>
    <select id="kind" name="kind" style="width:200px">
    <option value="0" >请选择</option>
     <%
String sql="";
sql="select kind from materials group by kind"; 
         ResultSet rs=stmt.executeQuery(sql);
         while(rs.next())
         { 
        %>
             <option value="<%out.print(rs.getString(1));%>"><%out.print(rs.getString(1));%></option>
             <% 
         } 
 rs.close();
  %>      
    </select>
    </td>
  </tr>
    
  <tr>
    <td align="center">物料名称</td>
    <td>
    <select id="name" name="name" style="width:200px" onchange="checkStatus()">
             <option value="">请选择</option>
             <%
sql="select id,kind,name from materials";  
         rs=stmt.executeQuery(sql);
         while(rs.next())
  { 
     %>
            <option value="<%out.print(rs.getString(1));%>" parentid="<%out.print(rs.getString(2));%>"><%out.print(rs.getString(3));%></option>
             <% 
         } 
 rs.close();
 stmt.close();
 conn.close();
 %>
             </select>
      
    </td>
     </select>
  </tr>
  
  <tr>
    <td align="center">库存数量</td>
    <td><input type="text" name="num"  id="cal1" value="" width="200px"/></td>
  </tr>