title: Edit a table in JSP page which edits the database
body: <p>my question is simple,i have made a JSP page having a table which displays the content of the database,now what m trying is to edit the details in table,which simultaneously edits the values in the database.
  I have written the code,everything looks good but ,its not editing the database,what to do ??
  Help is seriously needed and is appreciated a lot.
  Thanks in advance.</p>
  
  <pre><code>&lt;%@page import="java.sql.DriverManager"%&gt;
  &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&gt;
  &lt;%@page import="java.sql.*" %&gt;    
  
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;title&gt;Insert title here&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;/body&gt;
  &lt;form method="post"&gt;
  
  &lt;table border="7"&gt;
  &lt;tr&gt;
  &lt;td&gt;ID&lt;/td&gt;
  &lt;td&gt;NAME&lt;/td&gt;
  &lt;td&gt;SKILL&lt;/td&gt;
  &lt;td colspan="2" align="center"&gt;ACTION&lt;/td&gt;
  &lt;/tr&gt;
  
  
  &lt;%
  try
  {
  Class.forName("com.mysql.jdbc.Driver");
  String url="jdbc:mysql://localhost/test";
  String username="root";
  String password="root";
  String query="select * from jsp1";
  
  Connection conn=DriverManager.getConnection(url,username,password);
  Statement stmt=conn.createStatement();
  
  
  ResultSet rs=stmt.executeQuery(query);
  while(rs.next())
  {
  
  %&gt;
      &lt;tr&gt;
      &lt;td&gt;&lt;%=rs.getInt("ID") %&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="text" value="&lt;%=rs.getString("NAME") %&gt;"&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="text" value="&lt;%=rs.getString("SKILL") %&gt;"&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="button" name="UPDATE" value="UPDATE" onclick="
      &lt;% 
      String qmod="update jsp1 set NAME=?,SKILL=? where ID=? ";
      PreparedStatement pstmt=conn.prepareStatement(qmod);
      String one=request.getParameter("NAME");
      String two=request.getParameter("SKILL");
      String three=request.getParameter("ID");
      pstmt.setString(1,one);
      pstmt.setString(2,two);
      pstmt.setString(3,three);
      pstmt.executeUpdate(); 
      %&gt;"&gt;&lt;/td&gt;
      &lt;td&gt; &lt;input type="button" name="DELETE" value="DELETE"&gt;&lt;/td&gt;
      &lt;/tr&gt;
          &lt;%
  
  }
  %&gt;
      &lt;/table&gt;
      &lt;%
      rs.close();
      stmt.close();
      conn.close();
      }
      catch(Exception e)
      {
          e.printStackTrace();
          }
  
  
  
  
  
  
  %&gt;
  
  &lt;/form&gt;
  &lt;/html&gt;
  </code></pre>