<a th:href="@{userList}">1、@{userList}</a><br/>
<a th:href="@{./userList}">2、@{./userList}</a><br/>
<a th:href="@{../tiger/home}">3、@{../tiger/home}</a><br/>
<a th:href="@{/tiger/home}">4、@{/tiger/home}</a><br/>
<a th:href="@{https://www.baidu.com}">5、@{https://www.baidu.com}</a><br/>
<a th:href="@{userList(id=9527)}">1、@{userList(id=9527)}</a><br/>
<a th:href="@{userList(id=9527,name=华安)}">2、@{userList(id=9527,name=华安)}</a><br/>
<a th:href="@{userList(id=9527,name=${userName})}">3、@{userList(id=9527,name=${userName})}</a><br/>
空格属于特殊字符,必须使用单引号包含整个字符串,不用单引号会报错
<p class="css1 css2" th:class="'css1 css2'">样式</p>
后台使用:model.addAttribute("info", "Love you 中国"); 传值有空格也是没有问题的
<p th:text="${info}">info</p>
后台传值字符串有空格是可以的,可以使用 + 进行字符串连接
<p th:text="'small smile'+',very good.'">浅浅的微笑</p>
<p th:text="${8+8}"></p>
<p th:text="${number+8}"></p>
原文:https://www.cnblogs.com/yinchh/p/11919480.html