How to solve this error? I'm using thymeleaf together with spring and there's an error when parsing the following html segment.
org.springframework.expression.spel.SpelEvaluationException: EL1007E: Property or field 'items' cannot be found on null
When I add something to the cart it works. The problem is when it's empty.
`
<tr th:each="item : ${session.shoppingCart.items}">
<td th:text="${item.book.id}"></td>
<td th:text="${item.book.title}"></td>
<td><span th:text="${item.book.price}"></span>cash</td>
<td>
<form action="#" th:action="@{/cart/update}" method="post">
<input type="hidden" th:value="${item.book.id}" name="id"/>
<input type="number" min="1" th:value="${item.quantity}" name="qty"/>
<button type="submit">UPDATE</button>
</form>
</td>
<td><span th:text="${item.subTotal}"></span>cash</td>
<td>
<form action="#" th:action="@{/cart/remove}" method="post">
<input type="hidden" th:value="${item.book.id}" name="id"/>
<button type="submit">remove</button>
</form>
</td>
</tr>
`