I am doing a program in java .I have designed a java server page which has 3 drop down list's...countr y,state.I want to display only corresponding the values in drop down list state when a country is selected...(for example:-if India is selected,drop down list state must have only the name of states in India).I have created 2 tables country and state.Table country has country id and country name.Table state has state id,state name and a foreign key country id from table country.
ResultSet rs1=stmt.execut eQuery("select * from country where countryname='"+ coun+"'");
while(rs1.next( ))
{
Integer counid=Integer. parseInt(rs1.ge tString("countr yid"));
ResultSet rs= stmt.executeQue ry("select * from state where countryid="+cou nid);
%> <select name="stateddl" >
<option value="0">Selec t</option>
<% while(rs.next() )
{
%>
<option><%= rs.getString("s tatename")%></option>
<% } %>
</select>
<% }
}
[/CODE]
Full Code is attached with this message.
Please help me to complete this program...
Code:
String coun=request.getParameter("countryddl");[CODE]
while(rs1.next( ))
{
Integer counid=Integer. parseInt(rs1.ge tString("countr yid"));
ResultSet rs= stmt.executeQue ry("select * from state where countryid="+cou nid);
%> <select name="stateddl" >
<option value="0">Selec t</option>
<% while(rs.next() )
{
%>
<option><%= rs.getString("s tatename")%></option>
<% } %>
</select>
<% }
}
[/CODE]
Full Code is attached with this message.
Please help me to complete this program...
Comment