摘要: Java从JDK5.0开始便提供了四个meta-annotation用于自定义注解的时候使用,这四个注解为:@Target,@Retention,@Documented 和@Inherited。 @Target:用于描述注解的使用范围(即:被描述的注解可以用在什么地方),其源码如下: 1 2 3 4 阅读全文
posted @ 2018-09-12 14:32 小虎Tiger 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 变量表达式${ } 在控制器中往页面传递几个变量: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 @Controller public class IndexController { @RequestMapping(value="/index",method=RequestMet 阅读全文
posted @ 2018-09-12 12:23 小虎Tiger 阅读(1143) 评论(0) 推荐(0) 编辑
摘要: Thymeleaf默认提供了丰富的表达式工具类,这里列举一些常用的工具类。 Objects工具类 1 2 3 4 5 6 7 8 /* * 当obj不为空时,返回obj,否则返回default默认值 * 其同样适用于数组、列表或集合 */ ${#objects.nullSafe(obj,defaul 阅读全文
posted @ 2018-09-12 12:20 小虎Tiger 阅读(3499) 评论(0) 推荐(0) 编辑
摘要: Thymeleaf 条件语句 Posted on 2017-09-15 if 与 unless 假如现在有一个商品列表,当商品有评论时,显示view按钮,否则不显示。这时候就可以使用Thymeleaf的th:if标签来实现: 1 2 3 <a href="comments.html" th:href 阅读全文
posted @ 2018-09-12 12:14 小虎Tiger 阅读(313) 评论(0) 推荐(0) 编辑
摘要: Spring Boot支持FreeMarker、Groovy、Thymeleaf和Mustache四种模板解析引擎,官方推荐使用Thymeleaf。 spring-boot-starter-thymeleaf 在Spring Boot中使用Thymeleaf只需在pom中加入Thymeleaf的st 阅读全文
posted @ 2018-09-12 12:08 小虎Tiger 阅读(171) 评论(0) 推荐(0) 编辑