【问题标题】:Bootstrap duallistbox can't submit (bad request)Bootstrap duallistbox 无法提交(错误请求)
【发布时间】:2015-09-16 13:17:21
【问题描述】:

我正在使用 bootstrap duallistbox 在我的站点中进行多选。我正在使用spring mvc。问题是当我尝试发布我的选择时收到错误的请求响应。这是我的选择标签结构:

 <select multiple="multiple" name="selectedUsers" id="selectedUsers" class="form-control">
        <c:forEach items="${allUsers}" var="item">
          <c:choose>
            <c:when test="${fn:contains(selectedUsersList, item.id.toString())}">
            <option value="${item.id}" selected>${item.username}</option>
            </c:when>
            <c:otherwise>
              <option value="${item.id}">${item.username}</option>
            </c:otherwise>
          </c:choose>
          </c:forEach>
      </select>

发布的数据是: profileType=0&selectedUsers=4444444&selectedUsers=aaaaaa&selectedUsers=893247 &_selectedUsers=1

如您所见,我正在接收 selectedUsers 但不是以正确的方式进行绑定。

谁能指导我如何完成这项工作? 提前谢谢。

【问题讨论】:

    标签: twitter-bootstrap spring-mvc listbox multi-select


    【解决方案1】:

    没关系,问题是我期待 selectedUsers 中的整数列表,而我选择的一些 id-s 实际上是字符串。我将列表更改为列表并使用字符串而不是整数

    【讨论】:

      猜你喜欢
      • 2019-02-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-18
      • 1970-01-01
      • 1970-01-01
      • 2019-01-06
      • 1970-01-01
      相关资源
      最近更新 更多