diff --git a/spring-web-modules/spring-thymeleaf-4/pom.xml b/spring-web-modules/spring-thymeleaf-4/pom.xml index 2582044c0f..1e6be32801 100644 --- a/spring-web-modules/spring-thymeleaf-4/pom.xml +++ b/spring-web-modules/spring-thymeleaf-4/pom.xml @@ -9,9 +9,9 @@ com.baeldung - parent-boot-2 + parent-boot-3 0.0.1-SNAPSHOT - ../../parent-boot-2 + ../../parent-boot-3 diff --git a/spring-web-modules/spring-thymeleaf-4/src/main/java/com/baeldung/thymeleaf/expression/DinoController.java b/spring-web-modules/spring-thymeleaf-4/src/main/java/com/baeldung/thymeleaf/expression/DinoController.java index 6cbf1bae0e..ad2875106d 100644 --- a/spring-web-modules/spring-thymeleaf-4/src/main/java/com/baeldung/thymeleaf/expression/DinoController.java +++ b/spring-web-modules/spring-thymeleaf-4/src/main/java/com/baeldung/thymeleaf/expression/DinoController.java @@ -23,7 +23,7 @@ public class DinoController { model.addAttribute("dinos", dinos); System.out.println(dinos); - return "templates-3/index"; + return "index"; } @@ -32,7 +32,7 @@ public class DinoController { model.addAttribute("dinos", new Dino()); - return "templates-3/form"; + return "form"; } diff --git a/spring-web-modules/spring-thymeleaf-4/src/main/java/com/baeldung/thymeleaf/mvcdata/EmailController.java b/spring-web-modules/spring-thymeleaf-4/src/main/java/com/baeldung/thymeleaf/mvcdata/EmailController.java index 1bfe3f3428..bdf303ef62 100644 --- a/spring-web-modules/spring-thymeleaf-4/src/main/java/com/baeldung/thymeleaf/mvcdata/EmailController.java +++ b/spring-web-modules/spring-thymeleaf-4/src/main/java/com/baeldung/thymeleaf/mvcdata/EmailController.java @@ -1,7 +1,7 @@ package com.baeldung.thymeleaf.mvcdata; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpSession; +import jakarta.servlet.ServletContext; +import jakarta.servlet.http.HttpSession; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; @@ -41,21 +41,6 @@ public class EmailController { return "mvcdata/email-request-parameters"; } - @GetMapping("/email/sessionattributes") - public String emailSessionAttributes(HttpSession httpSession) { - httpSession.setAttribute("emaildata", emailData); - return "mvcdata/email-session-attributes"; - } - - @GetMapping("/email/servletcontext") - public String emailServletContext() { - servletContext.setAttribute("emailsubject", emailData.getEmailSubject()); - servletContext.setAttribute("emailcontent", emailData.getEmailBody()); - servletContext.setAttribute("emailaddress", emailData.getEmailAddress1()); - servletContext.setAttribute("emaillocale", emailData.getEmailLocale()); - return "mvcdata/email-servlet-context"; - } - @GetMapping("/email/beandata") public String emailBeanData() { return "mvcdata/email-bean-data"; diff --git a/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates-3/form.html b/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates-2/form.html similarity index 100% rename from spring-web-modules/spring-thymeleaf-4/src/main/resources/templates-3/form.html rename to spring-web-modules/spring-thymeleaf-4/src/main/resources/templates-2/form.html diff --git a/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates-3/index.html b/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates-2/index.html similarity index 100% rename from spring-web-modules/spring-thymeleaf-4/src/main/resources/templates-3/index.html rename to spring-web-modules/spring-thymeleaf-4/src/main/resources/templates-2/index.html diff --git a/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates-3/result.html b/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates-2/result.html similarity index 100% rename from spring-web-modules/spring-thymeleaf-4/src/main/resources/templates-3/result.html rename to spring-web-modules/spring-thymeleaf-4/src/main/resources/templates-2/result.html diff --git a/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates/mvcdata/email-servlet-context.html b/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates/mvcdata/email-servlet-context.html deleted file mode 100644 index b07573047e..0000000000 --- a/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates/mvcdata/email-servlet-context.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -

Subject

-

-

Content

-

-

Email address

-

-

Language

-

- - \ No newline at end of file diff --git a/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates/mvcdata/email-session-attributes.html b/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates/mvcdata/email-session-attributes.html deleted file mode 100644 index 9227171fc6..0000000000 --- a/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates/mvcdata/email-session-attributes.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -

Subject

-

-

Content

-

-

Email address

-

-

Language

-

- - \ No newline at end of file diff --git a/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates/url/index.html b/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates/url/index.html index a8ac95aea3..9eabfd8e42 100644 --- a/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates/url/index.html +++ b/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates/url/index.html @@ -10,8 +10,5 @@

-
-

-
\ No newline at end of file diff --git a/spring-web-modules/spring-thymeleaf-4/src/test/java/com/baeldung/thymeleaf/mvcdata/EmailControllerUnitTest.java b/spring-web-modules/spring-thymeleaf-4/src/test/java/com/baeldung/thymeleaf/mvcdata/EmailControllerUnitTest.java index 5e1190e174..12742e626c 100644 --- a/spring-web-modules/spring-thymeleaf-4/src/test/java/com/baeldung/thymeleaf/mvcdata/EmailControllerUnitTest.java +++ b/spring-web-modules/spring-thymeleaf-4/src/test/java/com/baeldung/thymeleaf/mvcdata/EmailControllerUnitTest.java @@ -48,20 +48,6 @@ public class EmailControllerUnitTest { .andExpect(content().string(containsString("en-US"))); } - @Test - public void whenCallSessionAttributes_thenReturnEmailData() throws Exception { - mockMvc.perform(MockMvcRequestBuilders.get("/email/sessionattributes")) - .andExpect(status().isOk()) - .andExpect(content().string(containsString("Good morning !"))); - } - - @Test - public void whenCallServletContext_thenReturnEmailData() throws Exception { - mockMvc.perform(MockMvcRequestBuilders.get("/email/servletcontext")) - .andExpect(status().isOk()) - .andExpect(content().string(containsString("jhon.doe@example.com"))); - } - @Test public void whenCallBeanData_thenReturnEmailData() throws Exception { mockMvc.perform(MockMvcRequestBuilders.get("/email/beandata"))