iam developing an small Java EE application and i have created a servelt to enter student data to the database. i have displayed student data in another servlet using HTML table.in HTML table i have added a button to Update student data as the first column.that means in each row there is a update button.My problem is i want to get the corresponding second column value when user clicks on any row in order to update the student data.In second column i have student ID. Below is my code
Calling myFunction();
out.println("<td><button type='button' onclick='myFunction()'>Update</button></td>");
MyJavascriptCode
out.println("<script>");
out.println("function myFunction()");
out.println("{");
out.println("var Row = document.getElementById('trid');");
out.println("var Cells = Row.getElementsByTagName('td');");
//call update using EntityManager
out.println();
out.println("}");
out.println("</script>");
My second question is how can i access Row and Cells variables? example: I want to print Row and Cells values using document.write();
Thanks in advance