더 많이 실패하기

[Thymleaf] spelevaluationexception: property or field 'name' cannot be found on null 본문

개념정리/웹 프로그래밍

[Thymleaf] spelevaluationexception: property or field 'name' cannot be found on null

김발자~ 2023. 9. 16. 10:41
반응형

410.

spelevaluationexception: property or field 'name' cannot be found on null

 

1
2
3
<div class="friendList" th:each="friend : ${friendList}">
        <span th:text="${friend?.name}"></span>
</div>
cs

 

위 코드처럼 요소 앞에 ? 을 붙여준다

(null이면 안 띄운다는 if의 의미)

 

참고 블로그

반응형
Comments