X-Git-Url: https://juplo.de/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fde%2Fjuplo%2Fdemo%2FDemoController.java;h=7a231732fe5751a99e564fd1af6a085234589d51;hb=f353d09d441ee556284ba94d69b41453f77a023f;hp=25b500bbd12e740c5a842bfdbc14f352df4d1b0a;hpb=1bf463088fe488cca79dd951c88d2254df8ab71d;p=demos%2Fspring-boot diff --git a/src/main/java/de/juplo/demo/DemoController.java b/src/main/java/de/juplo/demo/DemoController.java index 25b500b..7a23173 100644 --- a/src/main/java/de/juplo/demo/DemoController.java +++ b/src/main/java/de/juplo/demo/DemoController.java @@ -22,7 +22,7 @@ public class DemoController LoggerFactory.getLogger(DemoController.class); - @RequestMapping("/") + @RequestMapping(path = "/", params = { "!card", "!add", "!remove" }) public String display(@ModelAttribute Form form) { for (Integer id : form.cards.keySet()) @@ -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,25 +46,23 @@ 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=row") - public String addRow(@ModelAttribute Form form, @RequestParam Integer card) + @RequestMapping(path = "/", params = "add") + public String addRow(@ModelAttribute Form form, @RequestParam Integer add) { - LOG.info("Adding row {} to card #{}", form.row.get(card), card); - form.cards.get(card).put(form.row.get(card), Boolean.FALSE); + LOG.info("Adding row {} to card #{}", form.row.get(add), add); + form.cards.get(add).put(form.row.get(add), Boolean.FALSE); 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);