Sure! Since the processor associated with the th:if
attribute has a higher precedence than the one associated with the th:text
attribute, it will be evaluated first. Thus you can write:
<span th:if="${error != null && error.summary != null}" th:text="${error.summary}">Static summary</span>
You could even shorten it using:
<span th:text="${error?.summary}">Static summary</span>
But I think in this case, whether the summary exist or not, the span tag will be created, which is a bit ugly.
See more info about conditional expressions here.