You must Sign In to post a response.
  • Category: [About DotNetSpider]

    Dependent dynamic dropdown list from database jsp


    I am trying dropdown list in jsp. first i am trying
    bind dropdown list with district and then Taluka. When I select
    district then automatically bind a taluka drop down list.
    So how to do this, kindly make change in following. so
    i can understand where is my mistake.

    Connection conn = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;databaseName=GATEWAY", "sa", "allied007");
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("Select ID, DISTRICT From District_Master");

    Connection Talconn = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;databaseName=GATEWAY", "sa", "allied007");
    Statement Talstmt = Talconn.createStatement();
    ResultSet Talrs = Talstmt.executeQuery("Select id, District_id, Taluka From Taluka_Master");

    <select id="ddlStateName" name="ddlStateName" class="columnwidth1">
    <option value="0" selected>Select</option>
    <% while ( {%>
    <option value="<%=rs.getString("ID")%>"><%=rs.getString("DISTRICT")%></option>
    <% }%>

    <select name="ddlTalukaName" class="columnwidth1">
    <option value="0">Select</option>
    while ( {%>
    <option value="<%=Talrs.getString("ID")%>"><%=Talrs.getString("Taluka")%></option>
  • #766311
    you can go through below links


    Name : Dotnet Developer-2015
    Email Id

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #766326

    Refer below link this might be helpful to you, In this refer comment no 2 he is explaining how to get records from database and bind the same to dropdownlist using JSP.

    Give respect to your work, Instead of trying to impress your boss.

    Blog :

Sign In to post your comments