From 5503a9d1c731af8fa73f6fbb7ab990b9bf8530b8 Mon Sep 17 00:00:00 2001 From: doojia <konstantin_dujia@outlook.com> Date: Sun, 15 Sep 2024 01:53:48 +0800 Subject: [PATCH 1/2] fix: @{} is used in src and href. The IDE will report error if it is used in style. --- .../spring-boot-thymeleaf/src/main/resources/templates/url.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-thymeleaf/spring-boot-thymeleaf/src/main/resources/templates/url.html b/spring-boot-thymeleaf/spring-boot-thymeleaf/src/main/resources/templates/url.html index ded52686f..60ce5dff3 100644 --- a/spring-boot-thymeleaf/spring-boot-thymeleaf/src/main/resources/templates/url.html +++ b/spring-boot-thymeleaf/spring-boot-thymeleaf/src/main/resources/templates/url.html @@ -11,7 +11,7 @@ <h1>URL</h1> <br/> <a th:href="@{http://www.ityouknow.com/{pageId}/can-use-springcloud.html(pageId=${pageId})}">view</a> <br/> - <div th:style="'background:url(' + @{${img}} + ');'"> + <div th:style="'background:url(' + ${img} + ');'"> <br/><br/><br/> </div> </div> From 2a8bbd574d229157bdfbd6c03474c3608c582a96 Mon Sep 17 00:00:00 2001 From: doojia <konstantin_dujia@outlook.com> Date: Sun, 15 Sep 2024 02:07:09 +0800 Subject: [PATCH 2/2] fix: gender is better than sex. --- .../src/main/java/com/neo/web/ExampleController.java | 2 +- .../src/main/resources/templates/switch.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-boot-thymeleaf/spring-boot-thymeleaf/src/main/java/com/neo/web/ExampleController.java b/spring-boot-thymeleaf/spring-boot-thymeleaf/src/main/java/com/neo/web/ExampleController.java index 112760366..af05d2826 100644 --- a/spring-boot-thymeleaf/spring-boot-thymeleaf/src/main/java/com/neo/web/ExampleController.java +++ b/spring-boot-thymeleaf/spring-boot-thymeleaf/src/main/java/com/neo/web/ExampleController.java @@ -48,7 +48,7 @@ public String eq(ModelMap map) { @RequestMapping("/switch") public String switchcase(ModelMap map) { - map.addAttribute("sex", "woman"); + map.addAttribute("gender", "woman"); return "switch"; } diff --git a/spring-boot-thymeleaf/spring-boot-thymeleaf/src/main/resources/templates/switch.html b/spring-boot-thymeleaf/spring-boot-thymeleaf/src/main/resources/templates/switch.html index aef5a3031..80a9c6162 100644 --- a/spring-boot-thymeleaf/spring-boot-thymeleaf/src/main/resources/templates/switch.html +++ b/spring-boot-thymeleaf/spring-boot-thymeleaf/src/main/resources/templates/switch.html @@ -6,7 +6,7 @@ </head> <body> <div > - <div th:switch="${sex}"> + <div th:switch="${gender}"> <p th:case="'woman'">她是一个姑娘...</p> <p th:case="'man'">这是一个爷们!</p> <!-- *: case的默认的选项 -->