I am working on Myql database and netbeans. i want to edit the table in a Jsp page and i want to place new values in it. I mean the previous data in the table must be dispalyed after that i want to edit it and replace new values ...after this changes the database must be updated with new values....
below is the code for the table data which i can only see but i cant modify it.. can some one help me out its very URGENT!!
<%@ page language="java" import="java.sql.*"%>
<html>
<head><title>Read from mySQL Database</title>
</head>
<a href="index.jsp">Home</a>
<body>
<p align="center"><b>Update from the 'registration' table.</b><br> </p>
<div align="center" width="85%">
<center>
<table border="1" borderColor="#ffe9bf" cellPadding="0" cellSpacing="0" width="1000" height="63">
<tbody>
<td bgColor="#008080"><font color="#ffffff"><b>First Name</b></font></td>
<td bgColor="#008080"><font color="#ffffff"><b>Last Name</b></font></td>
<td bgColor="#008080"><font color="#ffffff"><b>Gender</b></font></td>
<td bgColor="#008080"><font color="#ffffff"><b>Date Of Birth</b></font></td>
<td bgColor="#008080"><font color="#ffffff"><b>Address</b></font></td>
<td bgColor="#008080"><font color="#ffffff"><b>Country</b></font></td>
<td bgColor="#008080"><font color="#ffffff"><b>State</b></font></td>
<td bgColor="#008080"><font color="#ffffff"><b>Pin Code</b></font></td>
<td bgColor="#008080"><font color="#ffffff"><b>E-mail Id</b></font></td>
<td bgColor="#008080"><font color="#ffffff"><b>Contact</b></font></td>
<%
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con=null;
ResultSet rst=null;
Statement stmt=null;
try{
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/Prashanth","root","");
stmt=con.createStatement();
rst=stmt.executeQuery("select * from registration ");
while(rst.next()){
%>
<tr>
<td bgColor="#ffff98" vAlign="top"><%=rst.getString("fname")%></td>
<td bgColor="#ffff98" vAlign="top"><%=rst.getString("lname")%></td>
<td bgColor="#ffff98" vAlign="top"><%=rst.getString("gender")%></td>
<td bgColor="#ffff98" vAlign="top"><%=rst.getString("dob")%></td>
<td bgColor="#ffff98" vAlign="top"><%=rst.getString("address")%></td>
<td bgColor="#ffff98" vAlign="top"><%=rst.getString("country")%></td>
<td bgColor="#ffff98" vAlign="top"><%=rst.getString("state")%></td>
<td bgColor="#ffff98" vAlign="top"><%=rst.getString("pin")%></td>
<td bgColor="#ffff98" vAlign="top"><%=rst.getString("email")%></td>
<td bgColor="#ffff98" vAlign="top"><%=rst.getString("contact")%></td>
</tr>
<% }
rst.close();
stmt.close();
con.close();
}
catch(Exception e){
System.out.println(e.getMessage());
}
%>
</tbody>
</table>
</center>
</div>
</body>
</html>