diff --git a/src/main/java/Repository.java b/src/main/java/Repository.java index 890dd4c..a5698c4 100644 --- a/src/main/java/Repository.java +++ b/src/main/java/Repository.java @@ -249,13 +249,14 @@ public static void updateTodoItem(TodoItem todoItem) { } - public static void deleteTodoItem(String id) { - String sql = "delete from TODO_ITEM where id = ?"; + public static void deleteTodoItem(String id, String user) { + String sql = "delete from TODO_ITEM where id = ? and user = ?"; Connection connection = getDBConnection(); try { PreparedStatement ps = connection.prepareStatement(sql); ps.setString(1, id); + ps.setString(2, user); ps.executeUpdate(); } catch (SQLException e) { throw new RuntimeException(e); diff --git a/src/main/java/TodoServlet.java b/src/main/java/TodoServlet.java index bbd55ea..89c9582 100644 --- a/src/main/java/TodoServlet.java +++ b/src/main/java/TodoServlet.java @@ -20,6 +20,8 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t String todo = request.getParameter("todo"); String delete = request.getParameter("delete"); + // UTF8-problem i chrome... + // String html = "