Split or move spring-thymeleaf module
This commit is contained in:
@@ -1,6 +1,16 @@
|
||||
## Spring Thymeleaf
|
||||
|
||||
This module contains articles about Spring with Thymeleaf
|
||||
|
||||
## Relevant Articles:
|
||||
|
||||
- [Working with Enums in Thymeleaf](https://www.baeldung.com/thymeleaf-enums)
|
||||
- [Changing the Thymeleaf Template Directory in Spring Boot](https://www.baeldung.com/spring-thymeleaf-template-directory)
|
||||
- [Spring Request Parameters with Thymeleaf](https://www.baeldung.com/spring-thymeleaf-request-parameters)
|
||||
- [Thymeleaf lists Utility Object](https://www.baeldung.com/thymeleaf-lists-utility)
|
||||
- [Working with Arrays in Thymeleaf](https://www.baeldung.com/thymeleaf-arrays)
|
||||
- [Spring Path Variables with Thymeleaf](https://www.baeldung.com/spring-thymeleaf-path-variables)
|
||||
- [Working with Boolean in Thymeleaf](https://www.baeldung.com/thymeleaf-boolean)
|
||||
- [Working With Custom HTML Attributes in Thymeleaf](https://www.baeldung.com/thymeleaf-custom-html-attributes)
|
||||
- [How to Create an Executable JAR with Maven](https://www.baeldung.com/executable-jar-with-maven)
|
||||
- [[<-- prev]](/spring-thymeleaf)
|
||||
@@ -35,6 +35,27 @@
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.tomcat.maven</groupId>
|
||||
<artifactId>tomcat7-maven-plugin</artifactId>
|
||||
<version>${tomcat7-maven-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>tomcat-run</id>
|
||||
<goals>
|
||||
<goal>exec-war-only</goal>
|
||||
</goals>
|
||||
<phase>package</phase>
|
||||
<configuration>
|
||||
<path>/</path>
|
||||
<enableNaming>false</enableNaming>
|
||||
<finalName>webapp.jar</finalName>
|
||||
<charset>utf-8</charset>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>spring-thymeleaf-2</finalName>
|
||||
</build>
|
||||
@@ -42,5 +63,6 @@
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<tomcat7-maven-plugin.version>2.2</tomcat7-maven-plugin.version>
|
||||
</properties>
|
||||
</project>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.thymeleaf.controller;
|
||||
package com.baeldung.thymeleaf.arrays;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.thymeleaf.controller;
|
||||
package com.baeldung.thymeleaf.booleanexpressions;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.thymeleaf.model;
|
||||
package com.baeldung.thymeleaf.customhtml;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.thymeleaf.controller;
|
||||
package com.baeldung.thymeleaf.customhtml;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
@@ -6,8 +6,6 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import com.baeldung.thymeleaf.model.Course;
|
||||
|
||||
/**
|
||||
* Handles requests for the student model.
|
||||
*
|
||||
@@ -18,13 +16,13 @@ public class CourseRegistrationController {
|
||||
@RequestMapping(value = "/registerCourse", method = RequestMethod.POST)
|
||||
public String register(@ModelAttribute Course course, Model model) {
|
||||
model.addAttribute("successMessage", "You have successfully registered for course: " + course.getName() + ".");
|
||||
return "courseRegistration.html";
|
||||
return "templates/courseRegistration.html";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/registerCourse", method = RequestMethod.GET)
|
||||
public String register(Model model) {
|
||||
model.addAttribute("course", new Course());
|
||||
return "courseRegistration.html";
|
||||
return "templates/courseRegistration.html";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.thymeleaf.controller;
|
||||
package com.baeldung.thymeleaf.requestparameters;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
1
spring-thymeleaf/.gitignore
vendored
1
spring-thymeleaf/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
/target/
|
||||
@@ -9,16 +9,11 @@ This module contains articles about Spring with Thymeleaf
|
||||
- [Spring and Thymeleaf 3: Expressions](https://www.baeldung.com/spring-thymeleaf-3-expressions)
|
||||
- [Spring MVC + Thymeleaf 3.0: New Features](https://www.baeldung.com/spring-thymeleaf-3)
|
||||
- [How to Work with Dates in Thymeleaf](https://www.baeldung.com/dates-in-thymeleaf)
|
||||
- [How to Create an Executable JAR with Maven](https://www.baeldung.com/executable-jar-with-maven)
|
||||
- [Working with Boolean in Thymeleaf](https://www.baeldung.com/thymeleaf-boolean)
|
||||
- [Working with Fragments in Thymeleaf](https://www.baeldung.com/spring-thymeleaf-fragments)
|
||||
- [Conditionals in Thymeleaf](https://www.baeldung.com/spring-thymeleaf-conditionals)
|
||||
- [Iteration in Thymeleaf](https://www.baeldung.com/thymeleaf-iteration)
|
||||
- [Working With Arrays in Thymeleaf](https://www.baeldung.com/thymeleaf-arrays)
|
||||
- [Spring with Thymeleaf Pagination for a List](https://www.baeldung.com/spring-thymeleaf-pagination)
|
||||
- [Working with Select and Option in Thymeleaf](https://www.baeldung.com/thymeleaf-select-option)
|
||||
- [Working With Custom HTML Attributes in Thymeleaf](https://www.baeldung.com/thymeleaf-custom-html-attributes)
|
||||
- [Spring Request Parameters with Thymeleaf](https://www.baeldung.com/spring-thymeleaf-request-parameters)
|
||||
- [[next -->]](/spring-thymeleaf-2)
|
||||
|
||||
### Build the Project
|
||||
@@ -35,7 +30,6 @@ Access the pages using the URLs:
|
||||
- http://localhost:8082/spring-thymeleaf/
|
||||
- http://localhost:8082/spring-thymeleaf/addStudent/
|
||||
- http://localhost:8082/spring-thymeleaf/listStudents/
|
||||
- http://localhost:8082/spring-thymeleaf/booleans/
|
||||
|
||||
The first URL is the home page of the application. The home page has links to the second and third pages.
|
||||
|
||||
|
||||
@@ -141,26 +141,6 @@
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.tomcat.maven</groupId>
|
||||
<artifactId>tomcat7-maven-plugin</artifactId>
|
||||
<version>${tomcat7-maven-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>tomcat-run</id>
|
||||
<goals>
|
||||
<goal>exec-war-only</goal>
|
||||
</goals>
|
||||
<phase>package</phase>
|
||||
<configuration>
|
||||
<path>/</path>
|
||||
<enableNaming>false</enableNaming>
|
||||
<finalName>webapp.jar</finalName>
|
||||
<charset>utf-8</charset>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
@@ -174,7 +154,6 @@
|
||||
|
||||
<!-- Maven plugins -->
|
||||
<cargo-maven2-plugin.version>1.6.1</cargo-maven2-plugin.version>
|
||||
<tomcat7-maven-plugin.version>2.2</tomcat7-maven-plugin.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
// package com.baeldung.thymeleaf;
|
||||
|
||||
// import org.springframework.boot.SpringApplication;
|
||||
// import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
// @SpringBootApplication
|
||||
// public class WorkingWithArraysInThymeleafApplication {
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// SpringApplication.run(WorkingWithArraysInThymeleafApplication.class, args);
|
||||
// }
|
||||
// }
|
||||
@@ -24,9 +24,6 @@
|
||||
<tr>
|
||||
<td><a th:href="@{/listBooks}" th:text="#{msg.ListBooks}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a th:href="@{/registerCourse}" th:text="#{msg.CourseRegistration}" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
package org.baeldung;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
package com.baeldung.thymeleaf;
|
||||
|
||||
import com.baeldung.thymeleaf.config.InitSecurity;
|
||||
import com.baeldung.thymeleaf.config.WebApp;
|
||||
import com.baeldung.thymeleaf.config.WebMVCConfig;
|
||||
import com.baeldung.thymeleaf.config.WebMVCSecurity;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@WebAppConfiguration
|
||||
@@ -1,15 +1,14 @@
|
||||
package org.baeldung;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
package com.baeldung.thymeleaf;
|
||||
|
||||
import com.baeldung.thymeleaf.config.InitSecurity;
|
||||
import com.baeldung.thymeleaf.config.WebApp;
|
||||
import com.baeldung.thymeleaf.config.WebMVCConfig;
|
||||
import com.baeldung.thymeleaf.config.WebMVCSecurity;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@WebAppConfiguration
|
||||
@@ -1,12 +1,9 @@
|
||||
package org.baeldung.security.csrf;
|
||||
|
||||
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf;
|
||||
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.user;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
package com.baeldung.thymeleaf.security.csrf;
|
||||
|
||||
import com.baeldung.thymeleaf.config.InitSecurity;
|
||||
import com.baeldung.thymeleaf.config.WebApp;
|
||||
import com.baeldung.thymeleaf.config.WebMVCConfig;
|
||||
import com.baeldung.thymeleaf.config.WebMVCSecurity;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -21,10 +18,12 @@ import org.springframework.test.web.servlet.request.RequestPostProcessor;
|
||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
|
||||
import com.baeldung.thymeleaf.config.InitSecurity;
|
||||
import com.baeldung.thymeleaf.config.WebApp;
|
||||
import com.baeldung.thymeleaf.config.WebMVCConfig;
|
||||
import com.baeldung.thymeleaf.config.WebMVCSecurity;
|
||||
import javax.servlet.Filter;
|
||||
|
||||
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf;
|
||||
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.user;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@WebAppConfiguration
|
||||
Reference in New Issue
Block a user