thymeleaf作为页面静态化,作用:
1、减少服务器压力
2、提供更好的服务体验
1、创建controller返回视图hello
/**
* @auther SyntacticSugar
* @data 2018/12/22 0022下午 10:46
*/
@Controller
public class HelloController {
@GetMapping("hello")
public String hello(Model model) {
model.addAttribute("name", "world");
return "hello";
}
@GetMapping("hello1")
public String hello1(Model map) {
User user = new User();
user.setAge(21);
user.setName("Jack Chen");
user.setFriend(new User("李小龙", 30));
map.addAttribute("user", user);