springboot+springcloud+vue学习(三)

thymeleaf模板 :(前端了解不多,主要使用vue,后期再做介绍)

springboot 对jsp不是很友好,官方推荐使用thymeleaf模板

Thymeleaf最大的特点是能够直接在浏览器中打开并正确显示模板页面,而不需要启动整个Web应用。

需要特别注意的是Thymeleaf对于URL的处理是通过语法@{…}来处理的。Thymeleaf支持绝对路径URL:<a th:href="@{http://www.thymeleaf.org}">Thymeleaf</a>

条件求值:<a th:href="@{/login}" th:unless=${session.user != null}>Login</a> 

for循环:

 <tr th:each="prod : ${prods}">    

  <td th:text="${prod.name}">Onions</td>      

  <td th:text="${prod.price}">2.41</td>      

  <td th:text="${prod.inStock}? #{true} : #{false}">yes</td>
</tr>

WebJars 可以将前端的css,JavaScript等资源打成前端资源包jar 供使用,非常方便简洁

猜你喜欢

转载自www.cnblogs.com/zhangxiaan/p/10219232.html