Spring MVC在方法参数中使用@ModelAttribute中遇到的一个bug

    @ResponseBody
    @RequestMapping(value = "/delete/{id}", method = {RequestMethod.GET})
    public String delete(@ModelAttribute("sysUser") SysUser sysUser, @PathVariable Integer id, Model model) {
        ... ...
    }

描述:此方法用来删除某个id的问卷,但是SysUser实体类中也有成员变量id,Spring MVC会将问卷的id值赋给SysUser实例的id,导致SysUser实例的id变化,引发错误!!!

你可能感兴趣的:(Spring,MVC,spring,mvc)