-
Notifications
You must be signed in to change notification settings - Fork 12.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
589 additions
and
1 deletion.
There are no files selected for viewing
76 changes: 76 additions & 0 deletions
76
3.x/spring-boot-thymeleaf/spring-boot-thymeleaf-layout/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.neo</groupId> | ||
<artifactId>spring-boot-thymeleaf-layout</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>spring-boot-thymeleaf-layout</name> | ||
<description>Demo project for Spring Boot</description> | ||
|
||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>3.0.0</version> | ||
<relativePath/> <!-- lookup parent from repository --> | ||
</parent> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<java.version>17</java.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-thymeleaf</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>nz.net.ultraq.thymeleaf</groupId> | ||
<artifactId>thymeleaf-layout-dialect</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-devtools</artifactId> | ||
<scope>runtime</scope> | ||
<optional>true</optional> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.vintage</groupId> | ||
<artifactId>junit-vintage-engine</artifactId> | ||
<scope>test</scope> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>org.hamcrest</groupId> | ||
<artifactId>hamcrest-core</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
<configuration> | ||
<fork>true</fork> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
|
||
</project> |
13 changes: 13 additions & 0 deletions
13
...boot-thymeleaf/spring-boot-thymeleaf-layout/src/main/java/com/neo/TLayoutApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.neo; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class TLayoutApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(TLayoutApplication.class, args); | ||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
...oot-thymeleaf/spring-boot-thymeleaf-layout/src/main/java/com/neo/web/IndexController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.neo.web; | ||
|
||
import org.springframework.stereotype.Controller; | ||
import org.springframework.ui.ModelMap; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
|
||
@Controller | ||
public class IndexController { | ||
|
||
@RequestMapping("/index") | ||
public String index() { | ||
return "index"; | ||
} | ||
|
||
@RequestMapping("/fragment") | ||
public String fragment() { | ||
return "fragment"; | ||
} | ||
|
||
@RequestMapping("/layout") | ||
public String layout() { | ||
return "layout"; | ||
} | ||
|
||
@RequestMapping("/home") | ||
public String home() { | ||
return "home"; | ||
} | ||
|
||
|
||
} |
2 changes: 2 additions & 0 deletions
2
...ing-boot-thymeleaf/spring-boot-thymeleaf-layout/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
com.neo.title=\u7EAF\u6D01\u7684\u5FAE\u7B11 | ||
com.neo.description=\u5206\u4EAB\u751F\u6D3B\u548C\u6280\u672F |
15 changes: 15 additions & 0 deletions
15
...spring-boot-thymeleaf/spring-boot-thymeleaf-layout/src/main/resources/templates/base.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> | ||
<head th:fragment="common_header(title,links)"> | ||
<title th:replace="${title}">comm title</title> | ||
|
||
<link rel="stylesheet" type="text/css" media="all" th:href="@{/css/myapp.css}"> | ||
<link rel="shortcut icon" th:href="@{/images/favicon.ico}"> | ||
<script type="text/javascript" th:src="@{/js/myapp.js}"></script> | ||
|
||
<th:block th:replace="${links}" /> | ||
</head> | ||
<body> | ||
|
||
</body> | ||
</html> |
11 changes: 11 additions & 0 deletions
11
...ng-boot-thymeleaf/spring-boot-thymeleaf-layout/src/main/resources/templates/fragment.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> | ||
<head th:replace="base :: common_header(~{::title},~{::link})"> | ||
<title>Fragment - Page</title> | ||
<link rel="stylesheet" th:href="@{/css/bootstrap.min.css}"> | ||
<link rel="stylesheet" th:href="@{/cs/fragment.css}"> | ||
</head> | ||
<body> | ||
|
||
</body> | ||
</html> |
11 changes: 11 additions & 0 deletions
11
...spring-boot-thymeleaf/spring-boot-thymeleaf-layout/src/main/resources/templates/home.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" layout:decorate="layout"> | ||
<head> | ||
<meta charset="UTF-8"></meta> | ||
<title>Home</title> | ||
</head> | ||
<body> | ||
<div layout:fragment="content" > | ||
<h2>个性化的内容</h2> | ||
</div> | ||
</body> | ||
</html> |
11 changes: 11 additions & 0 deletions
11
...pring-boot-thymeleaf/spring-boot-thymeleaf-layout/src/main/resources/templates/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> | ||
<head> | ||
<meta charset="UTF-8"></meta> | ||
<title>Index</title> | ||
</head> | ||
<body> | ||
<div th:insert="layout/copyright :: copyright"></div> | ||
<div th:replace="layout/copyright :: copyright"></div> | ||
</body> | ||
</html> |
15 changes: 15 additions & 0 deletions
15
...ring-boot-thymeleaf/spring-boot-thymeleaf-layout/src/main/resources/templates/layout.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"> | ||
<head> | ||
<meta charset="UTF-8"></meta> | ||
<title>Layout</title> | ||
</head> | ||
<body> | ||
<div > | ||
<div th:replace="layout/header :: header"></div> | ||
<div th:replace="layout/left :: left"></div> | ||
<div layout:fragment="content" > content</div> | ||
<div th:replace="layout/footer :: footer"></div> | ||
</div> | ||
</body> | ||
</html> |
12 changes: 12 additions & 0 deletions
12
...thymeleaf/spring-boot-thymeleaf-layout/src/main/resources/templates/layout/copyright.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> | ||
<head> | ||
<meta charset="UTF-8"></meta> | ||
<title>Title</title> | ||
</head> | ||
<body> | ||
<copyright th:fragment="copyright"> | ||
© 2018 | ||
</copyright> | ||
</body> | ||
</html> |
12 changes: 12 additions & 0 deletions
12
...ot-thymeleaf/spring-boot-thymeleaf-layout/src/main/resources/templates/layout/footer.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> | ||
<head> | ||
<meta charset="UTF-8"></meta> | ||
<title>footer</title> | ||
</head> | ||
<body> | ||
<footer th:fragment="footer"> | ||
<h1>我是 尾部</h1> | ||
</footer> | ||
</body> | ||
</html> |
12 changes: 12 additions & 0 deletions
12
...ot-thymeleaf/spring-boot-thymeleaf-layout/src/main/resources/templates/layout/header.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> | ||
<head> | ||
<meta charset="UTF-8"></meta> | ||
<title>header</title> | ||
</head> | ||
<body> | ||
<header th:fragment="header"> | ||
<h1>我是 头部</h1> | ||
</header> | ||
</body> | ||
</html> |
12 changes: 12 additions & 0 deletions
12
...boot-thymeleaf/spring-boot-thymeleaf-layout/src/main/resources/templates/layout/left.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> | ||
<head> | ||
<meta charset="UTF-8"></meta> | ||
<title>left</title> | ||
</head> | ||
<body> | ||
<left th:fragment="left"> | ||
<h1>我是 左侧</h1> | ||
</left> | ||
</body> | ||
</html> |
16 changes: 16 additions & 0 deletions
16
...thymeleaf/spring-boot-thymeleaf-layout/src/test/java/com/neo/TLayoutApplicationTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.neo; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.junit4.SpringRunner; | ||
|
||
@RunWith(SpringRunner.class) | ||
@SpringBootTest | ||
public class TLayoutApplicationTests { | ||
|
||
@Test | ||
public void contextLoads() { | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.neo</groupId> | ||
<artifactId>spring-boot-thymeleaf</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>spring-boot-thymeleaf</name> | ||
<description>Demo project for Spring Boot</description> | ||
|
||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>3.0.0</version> | ||
<relativePath/> <!-- lookup parent from repository --> | ||
</parent> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<java.version>17</java.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-thymeleaf</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-devtools</artifactId> | ||
<scope>runtime</scope> | ||
<optional>true</optional> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.vintage</groupId> | ||
<artifactId>junit-vintage-engine</artifactId> | ||
<scope>test</scope> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>org.hamcrest</groupId> | ||
<artifactId>hamcrest-core</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
|
||
</project> |
13 changes: 13 additions & 0 deletions
13
...ring-boot-thymeleaf/spring-boot-thymeleaf/src/main/java/com/neo/ThymeleafApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.neo; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class ThymeleafApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(ThymeleafApplication.class, args); | ||
} | ||
|
||
} |
Oops, something went wrong.