From 957eb8c9fb0e2fe94a871e3e25cc40610d5abdd6 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Tue, 21 Jan 2020 21:07:09 +0100 Subject: [PATCH] WIP --- src/main/java/de/juplo/demo/DemoController.java | 12 +++++------- src/main/resources/templates/form.html | 6 +++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/main/java/de/juplo/demo/DemoController.java b/src/main/java/de/juplo/demo/DemoController.java index a83a4b1..cc2fcba 100644 --- a/src/main/java/de/juplo/demo/DemoController.java +++ b/src/main/java/de/juplo/demo/DemoController.java @@ -32,7 +32,7 @@ public class DemoController return "form"; } - @RequestMapping(path = "/", params = "add=card") + @RequestMapping(path = "/", params = "card=add") public String addCard(@ModelAttribute Form form) { Integer next = @@ -46,17 +46,15 @@ public class DemoController return "form"; } - @RequestMapping(path = "/", params = "remove=card") - public String removeCard( - @ModelAttribute Form form, - @RequestParam Integer card) + @RequestMapping(path = "/", params = "card!=add") + public String removeCard(@ModelAttribute Form form, @RequestParam Integer card) { Map content = form.cards.remove(card); LOG.info("Removed card #{} with content: {}", card, content); return "form"; } - @RequestMapping(path = "/", params = "add!=card") + @RequestMapping(path = "/", params = "add") public String addRow(@ModelAttribute Form form, @RequestParam Integer add) { LOG.info("Adding row {} to card #{}", form.row.get(add), add); @@ -64,7 +62,7 @@ public class DemoController return "form"; } - @RequestMapping(path = "/", params = "remove!=card") + @RequestMapping(path = "/", params = "remove") public String removeRow(@ModelAttribute Form form, @RequestParam String remove) { String[] parts = remove.split(":", 2); diff --git a/src/main/resources/templates/form.html b/src/main/resources/templates/form.html index f009beb..4105325 100644 --- a/src/main/resources/templates/form.html +++ b/src/main/resources/templates/form.html @@ -23,15 +23,15 @@
- +
-

+

-- 2.20.1