Thymeleaf 는 스프링과 Integration 이 잘 되어 있고, 지원하는 기능들도 많아서 자주 쓰이는 템플릿 엔진 중 하나이다. 이번에는 Thymeleaf 를 사용하면서 빈번하게 맞닥뜨리는 에러에 대해 소개해보려 한다. 개인적으로도 Thymeleaf 를 사용하면서 가장 많이 만났던 에러이다.
There was an unexpected error (type=Internal Server Error, status=500).
An error happened during template parsing (template: "class path resource [templates/member/createMemberForm.html]")
실제로 Thymeleaf 를 사용해보면, 가장 많이 마주치는 에러가 바로 파싱 에러다.
html 의 파라미터 철자가 틀렸거나, 객체를 잘못 넘겨주거나 등등 수 많은 이유로 발생해서 이유를 찾는데 시간이 좀 소요된다.
Caused by: java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'memberForm' available as request attribute
이번에 내가 마주친 에러는 객체 자체를 사용할 수 없다는 것이었다.
MemberForm 이라는 객체를 사용할 수 없다는 것이었다.
Property or field 'city' cannot be found on object of type
=> 다음은 실제로 발생하는 오류이다.
<th: text = "${member.address.city}">