org.springframework.expression.spel.SpelEvaluationException: EL1007E: Property or field 'chargesName' cannot be found on null

后端 未结 2 696
余生分开走
余生分开走 2020-12-21 16:39

My project based on spring boot,Thymeleaf,mysql,html and Jquery.

My scenario is to Get the List iterate and show the d

2条回答
  •  再見小時候
    2020-12-21 17:18

    You used the form at the top of your html page:

    The th:field="*{chargesName} is bound to the object/bean inside your th:object="${entSetCharges}. Meaning that you are searching for a chargesName field inside your entSetCharges object which does not exist or is null.

    Solution:

    • Maybe change your th:field="*{chargesName}" to ${savedcharges.chargesName} expression to access your object's field.

    • Try adding respondResult.addObject("entSetCharges",new EntSetCharges()); above your return line. Your view doesn't automatically create this object for you.

提交回复
热议问题