How can access jdbc connection using jsp in a javascript table

cliectGailt

New Member
I have a table using javascript. How can i implement jdbc connection using jsp in this table? I want to save the table into database. Anyone please help me.The code is given below.Here is the javascript code\[code\] <script language="javascript">var rowCount =0; function calculatePrice(qtyElement, costElement, priceElement) { priceElement.value = http://stackoverflow.com/questions/14497818/qtyElement.value * costElement.value; }function addRow(tableID){var table = document.getElementById(tableID);var rowCount = table.rows.length;var row = table.insertRow(rowCount);var cell1 = row.insertCell(0);var element1 = document.createElement("input");element1.type = "checkbox";element1.name = "chk[]";cell1.appendChild(element1);var cell2 = row.insertCell(1);cell2.innerHTML = rowCount;var cell3 = row.insertCell(2);var element2 = document.createElement("input");element2.type = "text";element2.name = "item[]";element2.required = "required";cell3.appendChild(element2);var cell4 = row.insertCell(3);var element3 = document.createElement("input");element3.type = "text";element3.name = "qty[]";element3.onchange = function(){ calculatePrice(this, this.parentElement.parentElement.childNodes[4].childNodes[0], this.parentElement.parentElement.childNodes[5].childNodes[0]);};cell4.appendChild(element3);var cell5 = row.insertCell(4);var element4 = document.createElement("input");element4.type = "text";element4.name = "cost[]";element4.onchange = function(){ calculatePrice(this.parentElement.parentElement.childNodes[3].childNodes[0], this, this.parentElement.parentElement.childNodes[5].childNodes[0]);};cell5.appendChild(element4);var cell6 = row.insertCell(5);var element5 = document.createElement("input");element5.type = "text";element5.name = "price[]";cell6.appendChild(element5);} function deleteRow(tableID){try{var table = document.getElementById(tableID);var rowCount = table.rows.length;for(var i=0; i<rowCount; i++){ var row = table.rows; var chkbox = row.cells[0].childNodes[0]; if(null != chkbox && true == chkbox.checked) { table.deleteRow(i); rowCount--; i--; }}}catch(e){ alert(e);}} addRow('dataTable'); </script>\[/code\]Here is the body.\[code\] <INPUT type="button" value="http://stackoverflow.com/questions/14497818/Delete Row" onclick="deleteRow('dataTable')" /><form action="" method="post" enctype="multipart/form-data"> <TABLE id="dataTable" width="350px" border="1" style="border-collapse:collapse;"><TR><TH>Select</TH><TH>Sr. No.</TH><TH>Item</TH><TH>Quantity</TH><TH>Prize</TH><TH formula="cost*qty"summary="sum">Amount</TH></TR> </TABLE><script> addRow('dataTable'); </script> <input type="submit" value="http://stackoverflow.com/questions/14497818/Save" /></form>\[/code\]
 
Back
Top