Tag Archives: themleaf

The background object of thymeleaf is null, which solves the problem of error when the object is empty to get the property value

The sale object passed from the background is sale = null

 ${sale.warrantyPeriod}

You will be prompted that warrantyperiod cannot be found. Change it to the following:

 th:value="${sale?.warrantyPeriod}"

If the object is empty, the output is empty; if the object exists, the output property value.