web2021. 11. 1. 16:20

[Thymeleaf]Property or field 'name' cannot be found on null 해결방법

 

ex) data.category.name

 

이라는 객체를 부를려고 하는데 

 

category가 nulld이면 

 

Property or field 'name' cannot be found on null

 

에러가 나온다..

 

해결할려면...

 

ex) data.category?.name

Posted by thdeodls85