In HTML you can create such control using appropriate tags: — parent tag of drop-down list and — child tag of tag.
Spring MVC tag library has its own solution for the drop-down lists. In this post I will write about, form option tags. In the previous articles about form handling using Spring MVC I have made an overview of cases when we need to bind text field, check-boxes or radio buttons with a java object.
Almost all steps will be repeated for the select drop-down list element. Further I will examine three situations with drop-down lists in context of binding it with java object using Spring MVC tag library.
To be the expiration date of the existing Option Agreements prior to the rollover. Termination of Service. Method of Exercising Option.
The first case will be about form:select tag with values based on java. Map, the second example will be about usage of form:select tag in conjunction with form:option tags, the third example will be write a trading robot usage of form:select tag in conjunction with form:options tag.
Every example will have the same result jsp page, so only the form pages will be different and controllers for them.
Setup of configuration will be omitted because it was explained in the one of previous articles. We can implement this in several ways using the Spring MVC form tag library.
In the selectTag method I create a Map with values which will be displayed on page with drop-down. The second method processPhone ModelAttribute Smartphone smartphone will be used as a shared end point form option the all examples. And the appropriate JSP As specified in official Spring Documentation you can use any kind of java objects with appropriate getters and setters for the form:options tag: The items attribute is typically populated with a collection or array of item objects.
Alternatively, you may specify a Map of items, in which case the map keys are interpreted as option values and the map values correspond to option labels. Summary Each of these examples is convenient in particular situation and should be used rationally.
Хорошо, - сказала Сьюзан, стараясь сосредоточиться, - я сотру весь накопитель Хейла.
Source code of the tutorial you can find on GitHub.