Thymeleaf: show text if the attribute and property exists

<span th:if="${error != null && error.summary != null}" th:text="${error.summary}">Static summary</span>

Source: spring – Thymeleaf: show text if the attribute and property exists – Stack Overflow