From 76f9370eb564afef7679271cacac44e0564fe6ea Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Wed, 22 Jan 2020 00:53:41 +0100 Subject: [PATCH] Options can be removed from the map --- .../java/de/juplo/demo/DemoController.java | 8 ++++++ src/main/resources/templates/form.html | 27 ++++++++++++------- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/main/java/de/juplo/demo/DemoController.java b/src/main/java/de/juplo/demo/DemoController.java index c74a6e9..a9391db 100644 --- a/src/main/java/de/juplo/demo/DemoController.java +++ b/src/main/java/de/juplo/demo/DemoController.java @@ -47,4 +47,12 @@ public class DemoController } return display(form); } + + @RequestMapping(path = "/", params = "remove") + public String remove(@ModelAttribute Form form, @RequestParam String remove) + { + Boolean value = form.map.remove(remove); + log.info("Removed option \"{}\" with value {} from the map", remove, value); + return display(form); + } } diff --git a/src/main/resources/templates/form.html b/src/main/resources/templates/form.html index 70841c9..e3b1f90 100644 --- a/src/main/resources/templates/form.html +++ b/src/main/resources/templates/form.html @@ -16,17 +16,26 @@
Select / unselect the option and submit the form...
-
- - +
+
+ + +
-
- - +
+
+ + +
-
- - +
+
+ + + +
New Option -- 2.20.1