controller
@RequestMapping("/hello")
public String hello(Map<String, Object> map) {
map.put("hello","<h1>hello<h2>");
map.put("user", Arrays.asList("111","222","333"));
return "hello";
}
html
th:text="${hello}":获取变量hello
th:utext="${hello}":获取变量hello并且转义
th:each="users:${user}":遍历user中的数据到变量users
th:text="${users}":拿到变量users是数据输出到文本
<body>
<div th:text="${hello}"></div>
<div th:utext="${hello}"></div>
<h3 th:each="users:${user}" th:text="${users}">
</h3>
</body>