For me getting same result (all the text box are null value is filled) after move the textboxes after calling request.getParameter() also...
What i need to change it?
Where i need to edit?

First Jsp Page
       <%@ page import="java.sql.*" %>
        <% Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");%>
        <HTML>
        <HEAD>
        <TITLE>Fetching Data From a Database</TITLE>
        </HEAD>
        <BODY>
        <H1>Fetching Data From a Database</H1>
        <%
    Connection connection=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","password");  
    ResultSet resultset;
    Statement statement=connection.createStatement();
    resultset = statement.executeQuery("SELECT * FROM testtb");
    if (!resultset.next()) {
    out.println("Sorry, could not find the data. ");
    } else {
    %>
    <TABLE cellpadding="15" border="1" style="background-color: #ffffcc" align="center">
    <TR>
    <TH>Id</TH>
    <TH>Task Name</TH>
    <TH>Description</TH>
    <TH>Priority</TH>
    <TH>Date</TH>
      <TH>Time</TH>
    <TH>Edit</TH>
    <TH>Delete</TH>
    </TR>
    <%
    do {
    %>
    <TR>
    <TD> <%= resultset.getString(1)%> </TD>
    <TD> <%= resultset.getString(3)%> </TD>
    <TD> <%= resultset.getString(4)%> </TD>
    <TD> <%= resultset.getString(5)%> </TD>
    <TD> <%= resultset.getString(6)%> </TD>
     <TD> <%= resultset.getString(7)%> </TD>
    <TD><input type="button" name="edit" value="Edit" onClick="javascript:window.location='edit.jsp';" style="background-color:#49743D;font-weight:bold;color:#ffffff;">
    </TD>
    <TD><input type="button" name="delete" value="Delete" onClick="javascript:window.location='deleteData.jsp';"style="background-color:#ff0000;font-weight:bold;color:#ffffff;"></TD>
    </TR>
    <%resultset.next();
    } while (resultset.isAfterLast() != true);
    %>
    </TABLE>
    <BR>
    <%
    }
    %>
    </BODY>
    </HTML>

Second JSP Page

<%@ page language="java" import="java.sql.*"%>
<head>
</head>
<body>
  <form name="editform" method="post" action="edit.jsp">
    <%! String id = "";
    String taskname = "";
    String description = "";
    String priority = "";
    String date = "";
    String time = "";
    %>
    <br><br><br>
<%
id = request.getParameter("id");
taskname = request.getParameter("taskname");
description = request.getParameter("description");
priority = request.getParameter("priority");
date = request.getParameter("date");
    time = request.getParameter("time");
  %>           
<table align="center" width="300px" style="background-color:#EDF6EA;border:1px solid #000000;">
  <tr><td colspan=2 style="font-weight:bold;" align="center">Edit User</td></tr>
  <tr><td colspan=2 align="center" height="10px"></td></tr>
  <tr>
  <td>ID</td>
  <td><input type="text" name="id" value="<%=id%>"></td>
  </tr>
  <tr>
  <td>Task Name</td>
  <td><input type="text" name="taskname" value="<%=taskname%>"></td>
  </tr>
  <tr>
  <td>Descrption</td>
  <td><input type="text" name="description" value="<%=description%>"></td>
  </tr>
  <tr>
  <td>Priority</td>
  <td><input type="text" name="priority" value="<%=priority%>"></td>
  </tr>
  <tr>
  <td>Date</td>
  <td><input type="text" name="date" value="<%=date%>"></td>
  </tr>
  <tr>
  <td>Time</td>
  <td><input type="text" name="time" value="<%=time%>"></td>
  </tr>   
  <tr>
  <td></td>
  <td><input type="submit" name="Submit" value="Update" style="background-color:#49743D;font-weight:bold;color:#ffffff;"></td>
  </tr>
  <tr><td colspan=2 align="center" height="10px"></td></tr>
  </table>    
   <%  
    Statement stmt;
    Connection conn = null;
    String url = "jdbc:mysql://localhost:3306/test";
    String username = "root";
    String password = "password";
    String driver = "com.mysql.jdbc.Driver";  
out.println(request.getRequestURI());
if (id != null && taskname != null && description != null && priority != null && date != null && time != null) {
if (id != "" && taskname != "" && description != "" && priority != "" && date != "" && time != "") {
try {
Class.forName(driver).newInstance();
conn = DriverManager.getConnection(url,username,password);
System.out.println("Connected to the database");
//ArrayList al = null;
// ArrayList userList = new ArrayList();
String query = "UPDATE testtb SET id= "+id+",taskname=" + taskname + ",description=" + description + ",priority=" + priority + ",date=" + date + ",time=" + time + "";
stmt = conn.createStatement();
int i = stmt.executeUpdate(query);
System.out.println("query" + query);
if (i > 0) {
response.sendRedirect("welcome.jsp");
}
conn.close();
System.out.println("Disconnected from database");
%>
<br>
<TABLE style="background-color: #E3E4FA;"
WIDTH="30%" border="1">
<tr><th>Data Modified successfully in database.</th></tr>
</TABLE>
<%
} catch (Exception e) {
e.printStackTrace();
}
}
}
%>
</form>
</body>
</html>




Give me a brief description******
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.