From: Kai Moritz Date: Tue, 21 Jan 2020 20:07:09 +0000 (+0100) Subject: WIP X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=aafc0bfa8e74e8977c83fc75fd64fa4f1e5ebc3d;p=demos%2Fspring-boot WIP --- 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 @@
- +
-

+