1.配置thymeleaf
2.HTML代码头部需要添加以下代码
<link rel="stylesheet" type="text/css" href="/static/css/style.css" th:href="@{css/style.css}"/>
其中th为
<html lang="en" xmlns:th="http://www.thymeleaf.org">
3.关于controller和requestmapping
@Controller
//只能使用controller,如果使用RestController将只会返回字符串不会返回html页面
@RequestMapping("/login") //此处的request。。。是下面整个模块的地址,如果想要访问下面的方法
需要在下面的方法上面单独请求
public class LoginController {
@RequestMapping("") //需要在此处单独请求
public String login(){
return "/login";
}
}