Skip to content

Commit

Permalink
Split or move spring-thymeleaf module
Browse files Browse the repository at this point in the history
  • Loading branch information
catalin-burcea committed Oct 30, 2019
1 parent 749eff7 commit 2362615
Show file tree
Hide file tree
Showing 18 changed files with 60 additions and 76 deletions.
10 changes: 10 additions & 0 deletions spring-thymeleaf-2/README.md
Original file line number Diff line number Diff line change
@@ -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)
22 changes: 22 additions & 0 deletions spring-thymeleaf-2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,34 @@
<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>

<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>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.thymeleaf.controller;
package com.baeldung.thymeleaf.arrays;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.thymeleaf.controller;
package com.baeldung.thymeleaf.booleanexpressions;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.thymeleaf.model;
package com.baeldung.thymeleaf.customhtml;

import java.util.Date;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package com.baeldung.thymeleaf.controller;
package com.baeldung.thymeleaf.customhtml;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
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.
*
Expand All @@ -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";
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.thymeleaf.controller;
package com.baeldung.thymeleaf.requestparameters;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
Expand Down
1 change: 0 additions & 1 deletion spring-thymeleaf/.gitignore

This file was deleted.

6 changes: 0 additions & 6 deletions spring-thymeleaf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.

Expand Down
21 changes: 0 additions & 21 deletions spring-thymeleaf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand All @@ -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>

This file was deleted.

3 changes: 0 additions & 3 deletions spring-thymeleaf/src/main/webapp/WEB-INF/views/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ <h1>
<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>
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package org.baeldung;
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;

import com.baeldung.thymeleaf.config.InitSecurity;
import com.baeldung.thymeleaf.config.WebApp;
import com.baeldung.thymeleaf.config.WebMVCConfig;
import com.baeldung.thymeleaf.config.WebMVCSecurity;

@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(classes = { WebApp.class, WebMVCConfig.class, WebMVCSecurity.class, InitSecurity.class })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package org.baeldung;
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;

import com.baeldung.thymeleaf.config.InitSecurity;
import com.baeldung.thymeleaf.config.WebApp;
import com.baeldung.thymeleaf.config.WebMVCConfig;
import com.baeldung.thymeleaf.config.WebMVCSecurity;

@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(classes = { WebApp.class, WebMVCConfig.class, WebMVCSecurity.class, InitSecurity.class })
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -21,10 +18,12 @@
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
Expand Down

0 comments on commit 2362615

Please sign in to comment.