Is there a simple way in thymeleaf to show the content of an attribute property if the property and the attribute exist? If there\'s an attribute \"error\" with a property \
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:
Static summary
You could even shorten it using:
Static summary
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.