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

后端 未结 2 695
余生分开走
余生分开走 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:36

    I init the entity object like respondResult.addObject("entSetCharges",new EntSetCharges());

    @GetMapping(value="/setchargeslist")
        public ModelAndView doGetSetchargesList()
        {
            List listCharges = new ArrayList<>();
            ModelAndView respondResult = new ModelAndView("SetCharges");
            try {
                /*Get the set charges list*/
                listCharges = serSetCharges.doGetSetChargesList();
                if(listCharges!=null)
                {
                respondResult.addObject("savedchargeslist",listCharges);
                respondResult.addObject("entSetCharges",new EntSetCharges());
                }
                else
                {
                    respondResult.addObject("savedchargeslist",new ArrayList<>());
                }
    
            } catch (Exception e) {
                // TODO: handle exception
            }
            return respondResult;
        }
    

提交回复
热议问题