标签:col 不能 text 设置 head doc app doctype 语法
@Controller public class HelloWorldController { @RequestMapping("success") public String success(Map<String,Object> map) { map.put("hello","你好"); return"success"; } }
模版为:
<!DOCTYPE html>
<!--为了语法提示 xmlns:th="http://www.thymeleaf.org"-->
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Success</title>
</head>
<body>
成功
<!--th:text 将div里面的内容设置为-->
<div th:text="${hello}">
这里显示欢迎信息
</div>
</body>
</html>
在这里切记:不能使用@RestController这个注解。因为这个注解使用流的形式进行返回数据。
使用thymeleaf,跳转到对应页面,但是没有在页面上显示对应的数据
标签:col 不能 text 设置 head doc app doctype 语法
原文地址:https://www.cnblogs.com/qingmuchuanqi48/p/13214549.html