@RequestMapping(value = "/adCrowdEdit.s", method = RequestMethod.POST)
public String adCrowdEdit(Model model, HttpServletRequest request, HttpServletResponse response,
@ModelAttribute("command") Adcrowd command, @RequestParam(value="adTagString") String adTagString, BindingResult result) throws Exception {
    ... ...
}

以上代码会抛出异常:Errors/BindingResult argument declared without preceding model attribute. Check your handler method signature

原因分析以及解决办法:BindingResult的对象紧跟在@ModelAttribute声明的对象后面,这样Spring MVC的管理控制程序才能正确的完成绑定。

修改办法如下,红色字体标出: 萌萌的IT人,IT人的乐园

@RequestMapping(value = "/adCrowdEdit.s", method = RequestMethod.POST)
public String adCrowdEdit(Model model, HttpServletRequest request, HttpServletResponse response,
@ModelAttribute("command") Adcrowd command, BindingResult result, @RequestParam(value="adTagString") String adTagString) throws Exception {
    ... ...
}

 

相关文章:

  • 2022-12-23
  • 2021-07-06
  • 2021-11-27
  • 2021-07-10
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-04
  • 2021-07-12
  • 2022-02-06
  • 2021-07-15
相关资源
相似解决方案