I have this expression
<h2 class="topmargin_0 bottommargin_30" th:text="${user.name} || ${user.age} || ' years old'"></h2>
butn when I run the app. I have this error:
Could not parse as expression:
To concatenate, use +:
+
<h2 th:text="${user.name} + ${user.age} + 'years old'" ...>
Or use |:
|
<h2 th:text="|${user.name} ${user.age} years old|" ...>
UPDATE: I wrote a blog post to show all possible string concatentation options in depth.
2.1m questions
2.1m answers
60 comments
57.0k users