springboot(4)-thymeleaf

  • 目录讲解

    • src/main/java:存放java代码
    • src/main/resources/static 存放静态文件,比如 css、js、image
    • templates:存放静态页面jsp,html,tpl
    • config:存放配置文件,application.properties
  • 引入依赖 Thymeleaf

		<!--thymeleaf-->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-thymeleaf</artifactId>
		</dependency>

注意:如果不引人这个依赖包,html文件应该放在默认加载文件夹里面,
比如resources、static、public这个几个文件夹,才可以访问

github代码地址

原文地址:https://www.cnblogs.com/xeclass/p/12634196.html