From: Kai Moritz Date: Tue, 21 Jan 2020 23:53:41 +0000 (+0100) Subject: Options can be removed from the map X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=76f9370eb564afef7679271cacac44e0564fe6ea;p=demos%2Fspring-boot Options can be removed from the map --- 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