0
내부 객체 속성에 액세스 나는이 수업 Thymeleaf - 봄. 다른 객체
public class Guardian {
public Guardian() {
super();
}
private Long id;
private String name;
..
}
public class AlarmNotification {
private Long id;
private Guardian guardian;
}
내 Thymeleaf 템플릿
<td class="col_name" th:text="${alarmNotification.guardian.name}"></td>
에서이하지만
org.springframework.expression.spel.SpelEvaluationException: EL1007E: Property or field 'name' cannot be found on null
Guardian은 AlarmNotification에서 null입니다. 이름 속성에 액세스하려면 보호자를 초기화해야합니다. – jmw5598
컨트롤러에 설정되어 있습니다 –
컨트롤러 코드를 추가 할 수 있습니까? – jmw5598