是的,如果您使用
th:utext
而不是 th:text
,那么您所拥有的就有效。
<h2 th:utext="'LOCATION INFO Device <strong>' + ${deviceKey} + ' </strong> at ' + ${deviceEventTime}" />
不过,我个人会这样格式化:
<h2>
LOCATION INFO Device
<strong th:text="${deviceKey}" />
at
<span th:text="${deviceEventTime}">
</h2>
(可能会也可能不会,取决于您的实际要求。)
使用这种语法是可能的 - [(${brand})] ` 所有产品(按品牌) [(${品牌})]
`本例中的对象是 String,但您可以使用 ${object.something}。