How to create scrollbar in thymeleaf to return a string?

Hello, if I for example want to fill some fields of the object sleplennogo with a page, it will look something like this :
<form th:action="@{'/plantEdit/'+${boxId}}"
 th:object="${plant}" method="POST">
 <input th:type="hidden" name="id" th:field="${plant.id}" />
 Plant name:
 <input type="text" th:field="*{plantName}" />
<br/>
 <input type="submit" value="Create" />
 <a href="#" th:href="@{/}" role="button">Cancel</a>
</form>

ie if the action is on the page calls the controller responsible for the post and submitit the value that will be entered by the user , and, when this page only volunteered (get) , in compliance with the parameter "plant" was put object and then this object was passed to the function responsible for the post.
But I have, for example ,to raise data from a database-supported plant (names for example), after those names have to somehow convey to the page in the scrolling bar that the user has selected the plant and on to the controller passed this string (name) , a name from the database of the supported plants will be tightened some more data which are needed when creating the object which the user will put in his box.
here are my controllers :
@RequestMapping(value = {"/plantEdit/{boxId}", "/plantEdit/{boxId}/{id}"}, method = RequestMethod.GET)
 public String growBoxesEditForm(Model model,
 @PathVariable(name = "boxId") Long boxId,
 @PathVariable(required = false, name = "id") Long id) throws ResourceNotFoundException {

 logger.info("now we observe plant with id :" + id);

 if(id != null){
 model.addAttribute("plant", plantService.findById(id));
 }else {
 model.addAttribute("plant", new Plant());
}

 model.addAttribute("boxId", boxId);

 return "plantEdit";
}

 @RequestMapping(value = "/plantEdit/{boxId}", method = RequestMethod.POST)
 public String growBoxEditForm(Model model Plant plant
 @PathVariable(name = "boxId") Long boxId) throws ResourceNotFoundException {

 GrowBox box = growBoxService.findById(boxId);
plant.setResponsibleGrowBox(box);

plantService.savePlant(plant);

 model.addAttribute("plants", plantService.findByBoxId(boxId));
 return "showPlants";
 }

the question is how to write a scroll bar and process the selected value in the controller thanks in advance
March 23rd 20 at 19:41
1 answer
March 23rd 20 at 19:43
Solution
Frankly, I do not quite understand what you mean by "scrollbar"om, in this context...
Based on this text:
But I have, for example ,to raise data from a database-supported plant (names for example), after those names have to somehow convey to the page in the scrolling bar that the user has selected the plant and on

suppose you want to create a dropdown list with a scrollbar where the user can select data.

To implement do the following:
1) implement a method that returns a list (List) or an array of strings with the names of the plants. (in the Repository).
2) IN the GET request when the page is opened via Model ( model.addAttribute("plants", repo.getPlants()) ) to transmit this information.
3) next is the whole thing beautifully wrapped in a dropdown list.
https://getbootstrap.com/docs/4.3/components/dropdowns/

Possible plant you can store, in the database (if you expect frequent additions and removal of species) or can be stored in Enum.

.... how to handle the selected value in the controller ...

depends on what you choose. In a controller method can take a object and save it, you can take a enum and save it, you can take a String and using String.valueOf(myString) to save an enum, etc.
well, that supposedly such a list of values that falls out when you click on any arrow, because for example the user can enter the names of the tomato or tomato or something else, and then on the name to look for ,for example, the recommended temperature, a description and some info is not very reliable, so I want to have a list of plants which are already defined in the database and only such plants, the user can add to the box, well, Yes, the option enum in this case is very good, thank you - Jamison.White commented on March 23rd 20 at 19:46
@Jamison.White,

- you mean the dropdown list.
- is there a good jquery script Bootstrap Select, which has a huge functionality. The choice of multimachine, search in dropdown, custom input, etc.
if you decide to use the enum, then it is advisable to do the following:
1) specify the name in English in capital letters as it should be
2) appllication.properties to specify the translations (text values) of these enums. - Danyka.Howe commented on March 23rd 20 at 19:49

Find more questions by tags ThymeleafSpringJava