thymeleaf配制

pom.xml配制

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<!-- Thymeleaf 如何支持java8的时间LocalDate和LocalDatetime -->
<dependency>
    <groupId>org.thymeleaf.extras</groupId>
    <artifactId>thymeleaf-extras-java8time</artifactId>
</dependency>
<!-- WebJars -->
<dependency>
    <groupId>org.webjars</groupId>
    <artifactId>bootstrap</artifactId>
    <version>3.3.7</version>
</dependency>
<dependency>
    <groupId>org.webjars</groupId>
    <artifactId>jquery</artifactId>
    <version>3.2.1</version>
</dependency>

src/main/resources

创建目录static ,   templates


在spring-boot下,默认约定了Controller试图跳转中thymeleaf模板文件的的前缀prefix是”classpath:/templates/”,后缀suffix是”.html” 
这个在application.properties配置文件中是可以修改的
spring.thymeleaf.prefix: /templates/  
spring.thymeleaf.suffix: .html  
spring.thymeleaf.cache=false

猜你喜欢

转载自blog.csdn.net/maqingbin8888/article/details/82116544