FE/html
[Thymeleaf Error] EL1007E: Property or field 'name' cannot be found on null
잔망루피
2021. 12. 29. 19:41
org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "user.name" (template: "user/joinForm" - line 179, col 54)
Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1007E: Property or field 'name' cannot be found on null
에러문구
🍟 해결
<div class="label">
<lable for="username">Name</lable>
<input type="text" id="username" name="name" th:value="${userDto?.name}" class="form-control" placeholder="이름" requred autofocus>
</div>
"${userDto.name}"을 "${userDto?.name}"로 수정하고 해결했다.
?은 null이 발생할 수 있는 프로퍼티에 넣는다.
?은 if를 의미한다.
해결 x
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
첫 번째 코드를 두 번째 코드로 바꾸고 해결했다는 사람도 있던데..
나는 안 된다.
👇 참고
org.springframework.expression.spel.SpelEvaluationException: EL1007E:(pos 0): Property or field 'name' cannot be found on null
Thymeleaf에서 다음과 같은 예외에 직면할 수 있다. org.springframework.expression.spel.SpelEvaluationException: EL1007E:(pos 0): Property or field 'name' cannot be found on null 문제가 된 코드는 다음..
devday.tistory.com
https://okky.kr/article/506527
OKKY | intellij + spring boot + Thymeleaf + lombok 사용 시 evaluating SpringEL expression 에러 발생 ㅠ.ㅠ
안녕하세요;;; 인텔리 J 에서 Spring boot 프로젝트를 생성해서 인덱스 페이지를 띄운 상태인데, 컨트롤러에서 Model 객체로 데이터를 담아 index.html 페이지로 값을 넘기려는데 자꾸 th 태그의 값에 오
okky.kr
반응형