Skip to content

Commit f0d2c54

Browse files
authored
Merge pull request eugenp#4163 from jabyte/master
Remove all the files and add them back again
2 parents add380d + 4230806 commit f0d2c54

4 files changed

Lines changed: 94 additions & 0 deletions

File tree

‎spring-thymeleaf/pom.xml‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,27 @@
9898
<version>${springframework-security.version}</version>
9999
<scope>test</scope>
100100
</dependency>
101+
102+
<!-- <dependency>
103+
<groupId>org.springframework.boot</groupId>
104+
<artifactId>spring-boot-autoconfigure</artifactId>
105+
<version>2.0.1.RELEASE</version>
106+
<type>jar</type>
107+
</dependency>
108+
109+
<dependency>
110+
<groupId>org.springframework.boot</groupId>
111+
<artifactId>spring-boot-starter-test</artifactId>
112+
<scope>test</scope>
113+
</dependency> -->
101114

102115
<!-- Spring data -->
103116
<dependency>
104117
<groupId>org.springframework.data</groupId>
105118
<artifactId>spring-data-commons</artifactId>
106119
<version>${springFramework-data.version}</version>
107120
</dependency>
121+
108122
</dependencies>
109123

110124
<build>
@@ -117,6 +131,7 @@
117131
<failOnMissingWebXml>false</failOnMissingWebXml>
118132
</configuration>
119133
</plugin>
134+
120135
<plugin>
121136
<groupId>org.codehaus.cargo</groupId>
122137
<artifactId>cargo-maven2-plugin</artifactId>
@@ -136,6 +151,7 @@
136151
</configuration>
137152
</configuration>
138153
</plugin>
154+
139155
<plugin>
140156
<groupId>org.apache.tomcat.maven</groupId>
141157
<artifactId>tomcat7-maven-plugin</artifactId>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// package com.baeldung.thymeleaf;
2+
3+
// import org.springframework.boot.SpringApplication;
4+
// import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
6+
// @SpringBootApplication
7+
// public class WorkingWithArraysInThymeleafApplication {
8+
9+
// public static void main(String[] args) {
10+
// SpringApplication.run(WorkingWithArraysInThymeleafApplication.class, args);
11+
// }
12+
// }
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.baeldung.thymeleaf.controller;
2+
3+
import org.springframework.stereotype.Controller;
4+
import org.springframework.ui.Model;
5+
import org.springframework.web.bind.annotation.GetMapping;
6+
7+
@Controller
8+
public class ThymeleafArrayController {
9+
@GetMapping("/arrays")
10+
public String arrayController(Model model) {
11+
String[] continents = {"Africa", "Antarctica", "Asia", "Australia", "Europe", "North America", "Sourth America"};
12+
13+
model.addAttribute("continents", continents);
14+
15+
return "continents";
16+
}
17+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<!DOCTYPE html>
2+
<html xmlns:th="http://www.thymeleaf.org">
3+
<head>
4+
<title>Arrays in Thymeleaf</title>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
</head>
8+
9+
<body>
10+
<h3>THE CONTINENTS</h3>
11+
<p>
12+
We have a total of <span th:text="${continents.length}"></span>
13+
continents in this world. Following is a list showing their order
14+
based on the number of population in each of them.
15+
</p>
16+
17+
<ol>
18+
<li th:text="${continents[2]}"></li>
19+
<li th:text="${continents[0]}"></li>
20+
<li th:text="${continents[4]}"></li>
21+
<li th:text="${continents[5]}"></li>
22+
<li th:text="${continents[6]}"></li>
23+
<li th:text="${continents[3]}"></li>
24+
<li th:text="${continents[1]}"></li>
25+
</ol>
26+
27+
<ul th:each="continent : ${continents}">
28+
<li th:text="${continent}"></li>
29+
</ul>
30+
31+
<h4 th:each="continent : ${continents}" th:text="${continent}"></h4>
32+
33+
<p>
34+
The greatest <span th:text="${#arrays.length(continents)}"></span>
35+
continents.
36+
</p>
37+
38+
<p>
39+
Europe is a continent: <span
40+
th:text="${#arrays.contains(continents, 'Europe')}"></span>.
41+
</p>
42+
43+
<p>
44+
Array of continents is empty <span
45+
th:text="${#arrays.isEmpty(continents)}"></span>.
46+
</p>
47+
48+
</body>
49+
</html>

0 commit comments

Comments
 (0)