1.创建项目时选择web和thymeleaf,删除不需要的文件(选择文件,按delete)
2.js,css,img放在resource中的static中,页面放在resources中的templates
3.controller中的get请求方式
package com.cc.springboot.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class ProviderController {
//@RequestMapping(value="/providers",method= RequestMethod.GET)
@GetMapping("/providers")
public String list(){
return "provider/list";
}
}
4.热部署依赖和配置文件
org.springframework.boot
spring-boot-devtools
spring.thymeleaf.cache=false
5.引入css,图片引入,引入webjars(先pom依赖包)
org.webjars
jquery
3.3.1
访问页中,查看页面源代码,点击jquery链接出现代码,则说明webjars成功



