Merge pull request #4163 from jabyte/master
Remove all the files and add them back again
This commit is contained in:
commit
f0d2c54175
|
@ -98,6 +98,19 @@
|
|||
<version>${springframework-security.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||
<version>2.0.1.RELEASE</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency> -->
|
||||
|
||||
<!-- Spring data -->
|
||||
<dependency>
|
||||
|
@ -105,6 +118,7 @@
|
|||
<artifactId>spring-data-commons</artifactId>
|
||||
<version>${springFramework-data.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -117,6 +131,7 @@
|
|||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.cargo</groupId>
|
||||
<artifactId>cargo-maven2-plugin</artifactId>
|
||||
|
@ -136,6 +151,7 @@
|
|||
</configuration>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.tomcat.maven</groupId>
|
||||
<artifactId>tomcat7-maven-plugin</artifactId>
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
// 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);
|
||||
// }
|
||||
// }
|
|
@ -0,0 +1,17 @@
|
|||
package com.baeldung.thymeleaf.controller;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
@Controller
|
||||
public class ThymeleafArrayController {
|
||||
@GetMapping("/arrays")
|
||||
public String arrayController(Model model) {
|
||||
String[] continents = {"Africa", "Antarctica", "Asia", "Australia", "Europe", "North America", "Sourth America"};
|
||||
|
||||
model.addAttribute("continents", continents);
|
||||
|
||||
return "continents";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<title>Arrays in Thymeleaf</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h3>THE CONTINENTS</h3>
|
||||
<p>
|
||||
We have a total of <span th:text="${continents.length}"></span>
|
||||
continents in this world. Following is a list showing their order
|
||||
based on the number of population in each of them.
|
||||
</p>
|
||||
|
||||
<ol>
|
||||
<li th:text="${continents[2]}"></li>
|
||||
<li th:text="${continents[0]}"></li>
|
||||
<li th:text="${continents[4]}"></li>
|
||||
<li th:text="${continents[5]}"></li>
|
||||
<li th:text="${continents[6]}"></li>
|
||||
<li th:text="${continents[3]}"></li>
|
||||
<li th:text="${continents[1]}"></li>
|
||||
</ol>
|
||||
|
||||
<ul th:each="continent : ${continents}">
|
||||
<li th:text="${continent}"></li>
|
||||
</ul>
|
||||
|
||||
<h4 th:each="continent : ${continents}" th:text="${continent}"></h4>
|
||||
|
||||
<p>
|
||||
The greatest <span th:text="${#arrays.length(continents)}"></span>
|
||||
continents.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Europe is a continent: <span
|
||||
th:text="${#arrays.contains(continents, 'Europe')}"></span>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Array of continents is empty <span
|
||||
th:text="${#arrays.isEmpty(continents)}"></span>.
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue