
/**
* delete one product from the database
* @param request HTTP request
* @param connection database connection
* @return the form to display (the result screen if you like)
*/
protected void doDelete(HttpServletRequest request,
Connection connection)
throws SQLException
{
PreparedStatement stmt =
connection.prepareStatement(
“delete from products where id = ?”);
try
{
String id = request.getParameter(“id”);
stmt.setInt(1,Integer.parseInt(id));
stmt.executeUpdate();
}
finally
{
stmt.close();
}
}
/**
* create a new product in the database
* @param request HTTP request
* @param connection database connection
* @return the form to display (the result screen if you like) ...