html页面开头:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.w3.org/1999/xhtml">
比如:当前日期:2018年6月8日,超出平均值30%,
对应如下源码:
当前日期:<span th:text="${dt}"></span>超出平均值 <span th:text="${ratioPercent}+'%'"></span>,
其中显示百分比部分,
如果写成如下,则不显示百分号
<span th:text="${ratioPercent}">%</span>
如果写成如下,则提示错误
<span th:text="${ratioPercent}%"></span>
如果写成如下,则提示错误
<span th:text="${ratioPercent}+%"></span>
<p>The year is <span th:text="2013">1492</span>.</p>
<p>In two years, it will be <span th:text="2013 + 2">1494</span>.</p>
显示如下:
The year is 2013.
In two years, it will be 2015.
只会显示th:text里的内容,标签中间的文字并不会显示。
以上结论是亲测!
thymeleaf版本:3.0.1
更多企业内的技术应用和使用技巧,请移步至我的公众号【程序员实用技能】