0

I got problem with reading Boolean values from object with Thymeleaf. This is what it looks like in the code:

                    <tr th:each="item : ${individualTransactions}">
                        <td><span th:text="${item.itemName}"> </span></td>
                        <td><span th:text="${item.itemDescription}"> </span></td>
                        <td><span th:text="${item.itemCost}"> </span></td>
                        <td>
                            <div th:switch="${item.isUsed}">
                                <p th:case="true"> USED </p>
                                <p th:case="false"> USE </p>
                            </div>
                        </td>
                    </tr>

and this is the message: EL1008E: Property or field 'isUsed' cannot be found on object of type 'xxx.entity.Transaction' - maybe not public or not valid?

I don't know if the problem is in my syntax or in accessing the property. There is no problem with access to other properties.

krzysiekcr
  • 11
  • 3

1 Answers1

1

JavaBeans specification ยง8.3.2:

In addition, for boolean properties, we allow a getter method to match the pattern:

public boolean is<PropertyName>();

Your property name is used, not isUsed.

OrangeDog
  • 36,653
  • 12
  • 122
  • 207