Using a form to submit data to database
I have a servlet and I am trying to implement a form in the page so that it will submit from a text box a string into the database. Here is my code.
java.util.Date d = new java.util.Date();
java.sql.Timestamp t = new java.sql.Timestamp(d.getTime());
String data = "";
out.println("<form method=get>");
out.println("Enter Data: ");
out.println("<input type=text name='data' >");
out.println("<input type=submit value=Submit>");
out.println("</form>");
// Insert Data
PreparedStatement pst = con.prepareStatement("INSERT INTO FOO (NAME,DATE_MODIFIED) VALUES(?,?)");
pst.setString(1, data);
pst.setTimestamp(2, t);
pst.executeUpdate();
I believe this is incorrect in the <form> code. I do not know how to INSERT the data that is submitted from the <form>.

