# 代表 获取资源本地化文件<br/> $ 表示从model里面获取<br/> # $这2个可以一起用 比如#{'system.'+${model.id}} -----这相当于 #{system.01}的资源本地化文件中的system.01内容<br/> ------Request------ <p th:text="${msg}"></p> <p th:text="${#httpServletRequest.getAttribute('msg')}">111</p> ------Response------ <p th:text="${session.msg}"></p> <p th:text="${#httpSession.getAttribute('msg')}">111</p> ------ServletContext------- <p th:text="${application.myContextAttribute}"></p> <p th:text="${application.size()}"></p> <div th:each="attr:${application.keySet()}"> <span th:text="${attr}"></span> <!--<span th:text="${application.get(attr)}"></span>--> </div> -------Spring Beans---------<br/> <!--<p th:text="${@String.getApplicationUrl()}"></p>--> -------$和* (变量表达式和星号表达式)--------- <div th:object="${session.file}"> <p th:text="*{name}">111</p> <p th:text="*{path}">222</p> </div> -------th:if------- <div th:if="${session.file.name=='FileName'}" th:each="file,iterStat:${session.files}"> <p th:text="${file.name}">01</p> <p th:text="${file.path}">01</p> </div> -------th:each------- <div th:each="file,iterStat:${session.files}"> <p th:text="${file.name}">01</p> <p th:text="${file.path}">01</p> <p th:text="|index: ${iterStat.index}; count: ${iterStat.count}; size: ${iterStat.size}; first: ${iterStat.first}|"></p> </div> -------表达式功能对象:------- #dates:java.util.Date的功能方法类。<br/> #calendars:类似#dates,面向java.util.Calendar<br/> #numbers:格式化数字的功能方法类。<br/> #strings:字符串对象的功能类,contains,startWiths,prepending/appending等等。<br/> <p th:text="${#strings.isEmpty(msg)}"></p> #objects:对objects的功能类操作。<br/> #bools:对布尔值求值的功能方法。<br/> #arrays:对数组的功能类方法。<br/> #lists:对lists功能类方法<br/> #sets<br/> #maps<br/> #aggregates:对数组或者集合创建聚合的功能方法,<br/> th:text="${#aggregates.sum(o.orderLines.{purchasePrice * amount})}"<br/> #messages:在变量表达式中获取外部信息的功能类方法。<br/> #ids:处理可能重复的id属性的功能类方法。<br/>
thymeleaf标签总结
最新推荐文章于 2023-05-03 09:23:29 发布