需加配置(配置文件中(.yml | .properties))
spring:
# 配置 thymeleaf 视图解析器
thymeleaf:
prefix: /templates/
suffix: .html
访问后端
@Controller
@RequestMapping("/themleaf")
public class TestController {
private final String PARAM = "中文12";
private final static Map<String,String> OBJECT = new HashMap<>();
private final static List<Map<String,String>> OLIST = new ArrayList<>();
static {
OBJECT.put("name","张三");
OBJECT.put("age","26");
OBJECT.put("sex","男");
OLIST.add(OBJECT);
OLIST.add(OBJECT