Java 参数条件“;饮食限制搜索“;实际请求参数未满足:active={304,305}

Java 参数条件“;饮食限制搜索“;实际请求参数未满足:active={304,305},java,intellij-idea,mysql-workbench,Java,Intellij Idea,Mysql Workbench,我的控制器和模型。我选中了两个复选框,它应该将这些值30和305放入表中,但我得到了这个消息。任何帮助都将不胜感激 @RequestMapping(value="/add",method=RequestMethod.POST, params = {"dietaryrestrictionssearches"}) public String processUserDietaryRestrictions(@ModelAttribute @Valid User newUser,

我的控制器和模型。我选中了两个复选框,它应该将这些值30和305放入表中,但我得到了这个消息。任何帮助都将不胜感激

@RequestMapping(value="/add",method=RequestMethod.POST, params = {"dietaryrestrictionssearches"})
    public String processUserDietaryRestrictions(@ModelAttribute @Valid User newUser,

                                    @RequestBody List<Integer> dietaryrestrictionssearches,
                                    Errors errors, Model model) {

        if (errors.hasErrors()) {
            model.addAttribute("title", "AddUserRestriction");
            return "add";
        }

        if (!dietaryrestrictionssearches.isEmpty()) {

            List<DietaryRestrictionsSearch> drsObjs = (List<DietaryRestrictionsSearch>) dietaryRestrictionsRepository.findAllById(dietaryrestrictionssearches);
            if (!drsObjs.isEmpty()) {
                newUser.setDietaryrestrictionssearches(drsObjs);
            }
            userRepository.save(newUser);
            return "redirect:/selection/" + newUser.getId();
        }
        return "redirect:../add";
    }


@Entity
public class DietaryRestrictionsSearch {

    @Id
    private int restrict_id;

    @Column
    private String restrictions;

    public List<User> getUsers() {
        return users;
    }

    public void setUsers(List<User> users) {
        this.users = users;
    }

    @ManyToMany(mappedBy="dietaryrestrictionssearches")
    private List<User> users = new ArrayList<>();

    public DietaryRestrictionsSearch() {}


    public DietaryRestrictionsSearch(String restrictions, int restrict_id) {
        super();
        this.restrictions = restrictions;
        this.restrict_id = restrict_id;
    }
  //getters and setters
@RequestMapping(value=“/add”,method=RequestMethod.POST,params={“DietryRestrictionsSearches”})
公共字符串processUserDietaryRestrictions(@ModelAttribute@Valid User newUser,
@请求正文列表饮食限制搜索,
错误(模型){
if(errors.hasErrors()){
model.addAttribute(“title”、“AddUserRestriction”);
返回“添加”;
}
如果(!DietaryRestrictionsSearchs.isEmpty()){
List drsObjs=(List)dietryrestrictionsrepository.findAllById(dietryrestrictionsearks);
如果(!drsObjs.isEmpty()){
newUser.setDietryRestrictionsSearchs(drsObjs);
}
userRepository.save(newUser);
返回“重定向:/selection/”+newUser.getId();
}
返回“重定向:../add”;
}
@实体
公共类饮食限制搜索{
@身份证
私人int\U id;
@纵队
私有字符串限制;
公共列表getUsers(){
返回用户;
}
公共用户(列表用户){
this.users=用户;
}
@许多(mappedBy=“饮食限制搜索”)
private List users=new ArrayList();
公共饮食限制搜索(){}
公共饮食限制搜索(字符串限制,int restrict\u id){
超级();
这个限制=限制;
this.restrict\u id=restrict\u id;
}
//接球手和接球手

我查看了您的评论,但没有看到任何添加的信息。您是否进行了某种更改?如果我错过了,请原谅。我查看了您的评论,但没有看到任何添加的信息。您是否进行了某种更改?如果我错过了,请原谅。