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.
1.4m articles
1.4m replys
5 comments
57.0k users