Dynamic check box problem

Dynamic check box problem

In my project i have used a dynamic table, in the each row of that table there is one check box [that i have created dynamically]. Now my problem is that i can't access those values from that dynamic check boxes ... pleas help me as soon as possible...

View Answers

April 12, 2011 at 10:40 AM

1)application.jsp:

<%@ page import="java.sql.*" %>
<html>
<form name="form"  method="post" action="retcheck.jsp">
 <table border="1">
<tr><th></th><th>Name</th><th>Address</th></tr>
<%
int i=0;
Connection con = null;
String url = "jdbc:mysql://localhost:3306/";
String db = "test";
String driver = "com.mysql.jdbc.Driver";
String userName ="root";
String password="root";

int sumcount=0;
Statement st;
try{
Class.forName(driver).newInstance();
con = DriverManager.getConnection(url+db,userName,password);
String query = "select * from data";
st = con.createStatement();
ResultSet rs = st.executeQuery(query);
%>
<%
while(rs.next()){
%>
<tr><td><input type="checkbox" value="<%= rs.getString("id")%>"  onclick='enable_text()' name="check">
<td><input type="text" name="name" value="<%=rs.getString("name")%>"></td>
<td><input type="text" name="address" value="<%=rs.getString("address")%>"></td>
</tr>
<%
}
%>
<%
}
catch(Exception e){
e.printStackTrace();
}
%>
</table>
<input type="submit" value="Get">
</form>
</html>

2)retcheck.jsp:

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

<%
String id[]=request.getParameterValues("check");
%>
<form name="form">
<table border=1>
<tr><th>Name</th><th>Address</th></tr>
<%
Connection conn = null;
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root", "root");
ResultSet rs = null;
Statement st=null;
st=conn.createStatement();
for(int a=0;a<id.length;a++){
rs = st.executeQuery("select * from data where id='"+id[a]+"'");
while(rs.next()){ 
    %>
<tr>
    <td><input type="text" name="name" value="<%=rs.getString("name")%>"></td>
    <td><input type="text" name="address" value="<%=rs.getString("address")%>"></td></tr>
      <%
}
}
%>
</table>
</form>

April 12, 2011 at 12:38 PM

Thanks for the Help... ^_^

Ads









Related Tutorials/Questions & Answers:
Dynamic check box problem
Dynamic check box problem  In my project i have used a dynamic table, in the each row of that table there is one check box [that i have created dynamically]. Now my problem is that i can't access those values from that dynamic
problem with dynamic url
problem with dynamic url  Hello! I was asked to implement a dynamic url code below to a html template I designed. I am a web designer, and although I understand the code, there is something wrong with it, or maybe I didn't do
Advertisements
how to insert check box
how to insert check box   how to insert check box into jtable row in swing
check box left justification
check box left justification  how to make a check box left justification which is at right end? thanks in advance
click on check box
click on check box  I create a check box in HTML and when i click on my check box relative information in page store in database
check box in jsp
check box in jsp  hey guys i am working on a web based project using jsp. In my project 1 am having 9 check boxes in 3 rows in the same form. I want to select 1 check box from each row and also i want to avoid many check box
check box condition
check box condition  Hai, my application has two check box one for chart and another one for table.when We click chart check box download only chart but table also download.same problem in table slection..xsl coding was used
dynamic select box
dynamic select box  hello friends i created a form and details of city & locations have to be come from database. if city hyderabad chosen then locations of hyderabad only appear in location selectbox.plz send code it is more
Drag a Text Box into dynamic positions
Drag a Text Box into dynamic positions  Plz can anyone tell how can i drag a text box using mouse or arrow keys... Im doing a accounts projects and i need this feature for cheque configuration
HI Jsp check box..!
HI Jsp check box..!  Hi all.. I want to update the multiple values of database table using checkbox..after clicking submit the edited field has to update and rest has to enable to update...please help me..its urgent
dynamic select box
dynamic select box  thank u my dear friend.but i have a code like this will u plz edit and send to me in correct manner. i am waiting for it .if city selected then based on city locations have to come from database.if u send
combo box code problem
combo box code problem  in this my problem related to : when i select state MP then i wil open the its corresponding city but in database it only stores the option value no like MP at option value 10 then it will stores the 10
Problem With Combo Box Editable Property
Problem With Combo Box Editable Property  Hi I am new To Flex i had set Combo Box Editable Property as true. But I didn't get the property filtering in the combo box like when you enter text "S" in the combo box then the names
Insert value of dynamic generated text box in jsp using javascript
Insert value of dynamic generated text box in jsp using javascript  hello sir , i want to generate dynamic text box at run time and i did that using javascript code given at your site now sir problem is i am not able to insert
check box realtive information in page store in database
check box realtive information in page store in database  check box relative information in page store in database  hiiiiiiiii, Que I create a checkbox in html and when i click on my check box realtive information
Creating Check Box in Java Swing
Creating Check Box in Java Swing       This section illustrates you how to create a Check Box component in Java Swing. In this section, you can learn simply creating the Check Box
instead of text boxe i have to show check box as selected.
instead of text boxe i have to show check box as selected.  i have one text field. in that iam getting boolean value either true or false from... have to show check box as selected. Thanks In advance R.Raveen.
approve or reject multiple selected rows using check box
approve or reject multiple selected rows using check box   Select Article Document Type Document Sub Type
i want to select a multiple value of check box by using onclick or onchange event without using from submission
i want to select a multiple value of check box by using onclick or onchange event without using from submission   i have 4 check box name 1)profile... the result is ok but after getting value of first box now i want a result of second box
Check Box Midlet Example
;, "J2ME", "J2EE", "JSF"). if user select a check box... J2ME CheckBox ChoiceGroup MIDlet       This example illustrates how to create check
Problem
refused: connect"   Check that the server (something like EchoServer
Problem
"java.net.connectexception connection refused: connect"   Check
**Connectivity is not getting done in this program plz check it out wat is the problem with that Although i've made tables in MA-ACCESS**
**Connectivity is not getting done in this program plz check it out wat is the problem with that Although i've made tables in MA-ACCESS**  <p>import java.io.*; import java.awt.*; import java.awt.event.*; import
check
updated"); will the above code check if the user has entered value for empcode
DYNAMIC BINDING
DYNAMIC BINDING  WHAT IS DYNAMIC BINDING
in php installation problem ?
in php installation problem ?   php installation in 7th step did not display y/n dialog box how to solve the problem
dynamic textfields
dynamic textfields  Hi, I am a fresher and joined recently in one company. they gave me a desktop application project using swings.here is my... what is my problem is :if the user had syrup which is having 4 ingredients(zinc
dynamic polymorphism
dynamic polymorphism  Develop with suitable hierarchy, classes for Point, Shape, Rectangle, Square, Circle, Ellipse, Triangle, Polygon, etc. Design a simple test application to demonstrate dynamic polymorphism
To Retain the values entered in the text box after submit in jsp page
given all those. Now my problem is how can i retain those values entered in box...To Retain the values entered in the text box after submit in jsp page   i am working on a jsp pge which has many text boxes and one dynamic drop
dynamic jquery statement
dynamic jquery statement  dynamic jquery statement
dynamic form
dynamic form  I need to make a dynamic form using php, for example, i...("There was a problem while using XMLHTTP:\n" + req.statusText... { alert("There was a problem while using XMLHTTP:\n" + req.statusText

Ads