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.*"%>
<head><title>Read from mySQL Database</title>
<a href="index.jsp">Home</a>

<p align="center"><b>Update from the 'registration' table.</b><br>&nbsp;</p>

<div align="center" width="85%">
<table border="1" borderColor="#ffe9bf" cellPadding="0" cellSpacing="0" width="1000" height="63">

<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>

Connection con=null;
ResultSet rst=null;
Statement stmt=null;

rst=stmt.executeQuery("select * from registration ");


<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>
<% }

catch(Exception e){



can any one please help me out as it is very urgent

inside the while stmt include
stmt.executeUpdate("your update querry");

Re: editing the table in a database using JSP
inside the while stmt include
stmt.executeUpdate("your update querry");

NO its not working

If you want to update a row in your table , then come up with that table's primary key.
based on that id you can update your table and refresh that page which contain table data.
add this line after your hearder in line number 25 : <td bgColor="#008080"><font color="#ffffff"><b>Edit</b></font></td> and also insert this line after line number 52: <td bgColor="#ffff98" vAlign="top"><a href="editpage.jsp?edit_id=%=rst.getString("id")%>">Edit</a></td> then in editpage.jsp:
this page contains text boxes to enter new data, if we clicks edit link then it will go for update query some thing like : query="update registration set name=requert.getParameter("name") etc where id=requert.getParameter("id")"; After updating your query then redirect to main table data page.
then you can see edited values..

If your requirement is not this, then come up with clear information.