th:text ="${xxx.xxx}" 关键字 $ 引用内存变量
th:src =@{/xxx/xx} 使用@关键字 引用地址 ,既可以是绝对路径,也可以是相对路径
th:value 设置输入框的值
th:utext 和 th:text 区别在于针对“unescaped text” (保留文本)
th:attr 设置标签属性
th:if th:unless 条件判断语句
th:if="${user.name=="sean"}"
th:switch ,th:case 选择语句
th:each 循环语句
th:each="user: ${userList}"
th:text="${user.name}" th:value="${user.id}"
JavaScript 中,获取内存中的变量(所谓内存变量 ,则为后天使用model.addAttribute(“key”,“value”) 传递的值 只需要在js 中添加头,以及使用特殊的符号引用内存中的变量
dates 日期函数
获取当前时间
${#dates.createNow()}
${#dates.createNowForTimeZone()}
日期格式化 参数单个日期,日期数组,日期List ,日期Set ,以及需要格式化的日期格式
${#dates.format(date, 'dd/MMM/yyyy HH:mm')}
${#dates.arrayFormat(datesArray, 'dd/MMM/yyyy HH:mm')}
${#dates.listFormat(datesList, 'dd/MMM/yyyy HH:mm')}
${#dates.setFormat(datesSet, 'dd/MMM/yyyy HH:mm')}
获取日期的day,month 等等 ,该date 参数同上面一样,可以是数组,list 和Set
${#dates.day(date)}
${#dates.month(date)}
${#dates.year(date)}
${#dates.dayOfWeek(date)}
${#dates.hour(date)}
${#dates.minute(date)}
${#dates.second(date)}
${#dates.millisecond(date)}
Calendars 日历函数
获取当前时间
${#calendars.createNow()}
${#calendars.createNowForTimeZone()}
${#calendars.createToday()}
${#calendars.createTodayForTimeZone()}
格式化
${#calendars.format(cal, 'dd/MMM/yyyy HH:mm')}
。
。
参数同上一样
Numbers 数字函数
后面的参数 是设置最小整数数字
${#numbers.formatInteger(num,3)}
${#numbers.arrayFormatInteger(numArray,3)}
${#numbers.listFormatInteger(numList,3)}
${#numbers.setFormatInteger(numSet,3)}
设置最小整数数字和小数点分隔符
${#numbers.formatDecimal(num,3,2)}
${#numbers.arrayFormatDecimal(numArray,3,2)}
${#numbers.listFormatDecimal(numList,3,2)}
${#numbers.setFormatDecimal(numSet,3,2)}
格式化为百分数
${#numbers.formatPercent(num)}
${#numbers.arrayFormatPercent(numArray)}
${#numbers.listFormatPercent(numList)}
${#numbers.setFormatPercent(numSet)}
创建一个整数数组 ,可以指定自定义步长
${#numbers.sequence(from,to)}
${#numbers.sequence(from,to,step)}
String 函数
判断字符串是否为空
${#strings.isEmpty(name)}
${#strings.setIsEmpty(nameSet)}
字符串中是否包含某个字符
${#strings.contains(name,'ez')}
字符串是否以指定参数开始和结束
${#strings.startsWith(name,'Don')}
${#strings.endsWith(name,endingFragment)}
截取字符串
${#strings.substring(name,3,5)}
字符大小写转换
${#strings.toUpperCase(name)}
${#strings.toLowerCase(name)}
拆分字符串
${#strings.arraySplit(namesStr,',')} 返回 数组
${#strings.listSplit(namesStr,',')} 返回list
${#strings.setSplit(namesStr,',')}
${#strings.length(str)}
Arrays 函数
将object 转为数组
${#arrays.toArray(object)}
${#arrays.toStringArray(object)}
${#arrays.toIntegerArray(object)}
数组长度
${#arrays.length(array)}
是否为空
${#arrays.isEmpty(array)}
是否包含某个元素
${#arrays.contains(array, element)}
${#arrays.containsAll(array, elements)}
Aggregates 用于在数组或集合上的实用方法
求和
${#aggregates.sum(array)}
${#aggregates.sum(collection)}
求平均
${#aggregates.avg(array)}
${#aggregates.avg(collection)}