需要判断HashMap中是否存在对应的key,如果存在,则取出并输出,如果不存在,输出空
th:value="${#maps.containsKey(searchMap,‘keywords’)? searchMap.keywords:’’}"
unless,包含则不执行
th:unless="${#maps.containsKey(searchMap,‘category’)}"
src图片:
th:src="${item.image} "
utext会识别相关的标签,abbreviate:截取对应的字符:
th:utext="${#strings.abbreviate(item.name,100)}"
@{}里面写url地址,如果需要添加参数,则在url地址后面添加()
th:href="@{url地址(category=KaTeX parse error: Expected 'EOF', got '}' at position 12: {category})}̲" th:href="@{{url}(category=${category})}"
字符串替代
th:text="${#String.replace(spec.key,‘spec_’,’ ')}"
字符串以xxx开头
th:if="${#strings.startsWith(spec.key,‘spec_’)}"