Good day. There is a controller from which Enum is sent to the page for the drop-down list.
@RequestMapping("/registration") public String registration(Model model){ ArrayList<CourseLocation> location = new ArrayList<CourseLocation>(); for(CourseLocation loc : CourseLocation.values()) { location.add(loc); } model.addAttribute("locat", location); return "registration"; } On the page, the information is inserted in a loop,
LocationBtn:<br/> <select class="selectpicker" > <c:forEach items="${location}" var="location"> <option value ="${location.toString()}">${location.toString()}</option> </c:forEach> </select><br/> This good is in the form with other input type = "text" and the button is transferred to another controller to create a user. How can I transfer the required enum from the drop-down list to it?
@RequestParam(required = false) CourseLocation location, Maybe I can transfer to the page from the first controller not ArrayList but Enum itself? But I did not succeed.
I tried to transfer to the second controller @RequestParam (required = false) CourseLocation location.toString () but the compiler was not happy with this solution.
Perhaps there is an option to override option value = "$ {loc}" and assign it somewhere to $ {loc = location.toString ()}?
Someone faced with such a task?