써먹는 웹개발

[Thymeleaf] org.springframework.expression.spel.SpelEvaluationException: EL1007E:(pos 0): Property or field 'name' cannot be found on null 본문

Client/Thymeleaf

[Thymeleaf] org.springframework.expression.spel.SpelEvaluationException: EL1007E:(pos 0): Property or field 'name' cannot be found on null

kmhan 2021. 8. 9. 17:01


728x90
반응형

1. 나의 경우 파라미터에 @ModelAttribute("queryParam") QueryParams queryParams 가 없었다.

1
2
3
4
5
    @GetMapping(value = {"""/"})
    public String forwardMain(Model model,
                              @ModelAttribute("queryParams") QueryParams queryParams) {
        return "views/main/index";
    }
cs

2. 백앤드에서 문제가 없는데 프론트에서 문제가 생기는 경우
 - name의 상위 변수 뒤에 ?를 붙여줄 것

1
${member?.name}
cs

 

2번 참고 : https://spacedev.tistory.com/7

728x90
반응형


Comments