天天看點

thymeleaf模闆引擎https://github.com/thymeleaf/thymeleafhttps://github.com/thymeleaf/thymeleaf

https://github.com/thymeleaf/thymeleaf
thymeleaf模闆引擎https://github.com/thymeleaf/thymeleafhttps://github.com/thymeleaf/thymeleaf
https://github.com/thymeleaf/thymeleaf

 另一種模闆引擎FreeMarker

1.引入依賴

springboot直接引入:

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

2、在HTML檔案導入限制

<html  xmlns:th="http://www.thymeleaf.org">      

3、使用格式

thymeleaf模闆引擎https://github.com/thymeleaf/thymeleafhttps://github.com/thymeleaf/thymeleaf

 4、取值在标簽中 th:text=${}

thymeleaf模闆引擎https://github.com/thymeleaf/thymeleafhttps://github.com/thymeleaf/thymeleaf

取值方法:

thymeleaf模闆引擎https://github.com/thymeleaf/thymeleafhttps://github.com/thymeleaf/thymeleaf

 轉義和不轉義取值

thymeleaf模闆引擎https://github.com/thymeleaf/thymeleafhttps://github.com/thymeleaf/thymeleaf

 周遊取值數組

thymeleaf模闆引擎https://github.com/thymeleaf/thymeleafhttps://github.com/thymeleaf/thymeleaf

繼續閱讀