mirror of
https://github.com/JeffLi1993/springboot-learning-example.git
synced 2026-03-13 21:43:45 +08:00
Spring Boot WebFlux 整合 Thymeleaf
This commit is contained in:
@@ -46,6 +46,15 @@ public class CityWebFluxController {
|
||||
return cityHandler.deleteCity(id);
|
||||
}
|
||||
|
||||
@GetMapping("/hello")
|
||||
public Mono<String> hello(final Model model) {
|
||||
model.addAttribute("name", "泥瓦匠");
|
||||
model.addAttribute("city", "浙江温岭");
|
||||
|
||||
String path = "hello";
|
||||
return Mono.create(monoSink -> monoSink.success(path));
|
||||
}
|
||||
|
||||
private static final String CITY_LIST_PATH_NAME = "cityList";
|
||||
|
||||
@GetMapping("/page/list")
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>欢迎页面</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1 >你好,欢迎来自<p th:text="${city}"></p>的<p th:text="${name}"></p></h1>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user