Spring RequestParam

i have a form, which has an array wiht ints. i want to add an int to this forms array.
    @PostMapping(path = "/a")
    String addEntry(@Valid @ModelAttribute("form") Form form, Errors errors, Model model,
            @RequestParam(value = "id", required = false, defaultValue = "0") int id) {

        if (id != 0) {
            form.add(id);
            return mainMapping(model, form); // is the get mapping for /a
//     return "a";????
        }
       form.toNewEntry();
        return "redirect:/b";
    }

Form
    public void add(int id) {
        List<Integer> arr = getAlleys();

        if (arr.contains(id)) {
            return;
        }
        arr.add(id);
        setAlleys(arr);
        System.out.println(getAlleys()); // [1]
    }

Model toNewEntry() {
Model entry = Model();
        System.out.println(getAlleys()); // []
        entry.setAlleys(getAlleys());
        return entry;
    }

why is the array empty in the tonewentry func?
Was this page helpful?