'Thymeleaf, nested th:text does not show

Nested span with price does not show, only the one with h4. How to solve this out?

<h4 th:text="${dish.name}">chicken fried salad <span th:text="${dish.getPrice()}">45</span></h4>


Solution 1:[1]

First as the previous user told you, th:text=${dish.name} will overwrite whatever text you put inside the tag and it will place the value of dish.name instead.

Second - instead of dish.getPrice() you need to call just dish.price in order to view value of the .price attribute.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dada