表达式无法被解析的原因是什么?Controller
页面标签
显示内容
学习是最好的投资!
In Spring’s Controller method, the Model is injected through method parametersSimilar to this:
@RequestMapping("welcome") public String welcome(Model model) { model.addAttribute("whatever", new SomeObject()); return "welcome"; }
If you use ModelAndView, do this
@RequestMapping("welcome") public ModelAndView welcome() { ModelAndView mv = new ModelAndView("welcome"); mv.addObject("whatever", new SomeObject()); return mv; }
In addition, shouldn’t it be written like this in View?
<tr> <th th:text="#{whatever}">Name</th> <th th:text="#{whatever}">Price</th> </tr>
In Spring’s Controller method, the Model is injected through method parameters
Similar to this:
If you use ModelAndView, do this
In addition, shouldn’t it be written like this in View?
It is recommended to ask questions in the future. Do not take screenshots of the code. Use text. It is best to attach the complete source code and put it in the git repository.