Results 1 to 2 of 2
  1. #1
    meghana is offline Member
    Join Date
    Mar 2010
    Posts
    9
    Rep Power
    0

    Default dynamically query handling

    hi

    we are developing page that contain checkbox and textbox which are dynamically generated.when we click on check box textbox will be enable.we enter value in textbox.now we want to insert that values in database on click event of button. rest of values should not enter in database, but we are not manupulate dynamic button and check box.

    Source Code:

    <%@page session="false" %>
    <%@page import="java.util.*"%>
    <%@page import="java.sql.*"%>


    <html>
    <head> </head>
    <body>
    <%
    Statement st=null;
    Connection con=null;
    ResultSet rs=null;

    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con=DriverManager.getConnection("Jdbc:Odbc:unisoft ");
    st = con.createStatement();
    rs = st.executeQuery("SELECT * from course");
    %>
    <form name="form" method="post" action="">
    <table border="1" align="center" width=650 height=0 cellpadding=8>
    <tr>
    <td colspan=3> <font size=4> Fees Structure <hr> </font> </td>
    </tr>
    <tr>
    <td width=92> Course Name </td>
    <td width="7"> : </td>
    <td width="200"> <select name="course">
    <option value="abc">ABC</option>
    <% while(rs.next())
    {
    %>
    <option value="<%= rs.getString(1)%>"> <%= rs.getString(2) %></option>
    <% } %>
    </select> </td>
    <%
    }
    finally
    {
    if(st!=null) st.close();
    //if(rs!=null) rs.close();
    if(con!=null) con.close();
    }
    %>
    </tr>
    </table>
    <table border="1" align="center" width=650 height=0 cellpadding=8>
    <tr>
    <td width=92> Course Name </td>
    <td width="7"> : </td>
    <td width="200"> <select name="course">
    <option value="Day"> Day </option>
    </select>
    <td>&nbsp; </td>
    </tr>
    <tr align="center">
    <td> <input type="button" name="next" value="Next" style="width:100"> </td>
    <td> <input type="button" name="next" value="Reset" style="width:100"> </td>
    <td> <input type="button" name="next" value="Cancel" style="width:100"> </td>
    <td>&nbsp; </td>
    </tr>
    </table>
    </form>
    </body>
    </html>

    help us to solve that problem.

    thanks

    megha

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    6

    Default

    maybe have some onclick javascript for the submit button find the selected checkbox, and then its associated text field, copy the value into a second html form, and post that form back. this way the form going to the server will just have the one field that you wish to save.

Similar Threads

  1. How to resize the component dynamically??
    By Y. Progammer in forum New To Java
    Replies: 14
    Last Post: 03-17-2010, 05:04 PM
  2. How to create widgets dynamically
    By sarbuland in forum Advanced Java
    Replies: 0
    Last Post: 02-06-2008, 08:08 PM
  3. Dynamically changing the display
    By abhiN in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 01-22-2008, 11:19 PM
  4. Overloading methods dynamically
    By Syed.muddasir in forum New To Java
    Replies: 6
    Last Post: 07-31-2007, 02:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •