springboot推荐使用thymeleaf模板作用前端页面显示。但相比js查找资料略显困难,暂未发现其独特优势。
首先新建文件夹,这几个是springboot下默认静态资源访问路径,自定义路径的话这些就失效了。
在application.properties中添加如下配置:
spring.mvc.view.prefix=/pages/ spring.mvc.view.suffix=.html
最后在controller中添加如下代码:
@Controller @RequestMapping public class TestController { @RequestMapping