简体   繁体   English

如何获取春季在表格中选择的下拉值和ID

[英]how to get dropdown value and id selected in form in spring

I am using Spring MVC. 我正在使用Spring MVC。 In my model I have a Map (say optionsMap) that will display dropdown options in UI. 在我的模型中,我有一个Map(例如optionsMap),它将在UI中显示下拉选项。 This is a multi selection dropdown. 这是一个多选下拉列表。 Id is an integer and display value is a string. id是整数,显示值是字符串。 On submit of form, controller should be able to get id(s) and value(s) of the selected options into a map (selectedOptionsMap). 在提交表单时,控制器应能够将所选选项的ID和值获取到地图(selectedOptionsMap)中。

    <form:select path="selectedOptionsMap" id="deviceList" multiple="true"></form:select>

This has already been discussed at Multiple Select in Spring 3.0 MVC . 在Spring 3.0 MVC中的“多重选择”中已经对此进行了讨论。 Check it out. 看看这个。 You will need a custom editor here . 您将需要一个自定义编辑器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM