Spring引导post参数作为数组获取null值

时间:2017-07-19 22:25:21

标签: java spring-boot

<form id="addMessageForm" class="form-horizontal" method="post" action="addMessage" enctype="multipart/form-data">
    <div class="form-group ">
        <label class="control-label col-sm-3 requiredField" for="contacts"> Kontaktid 
            <span class="asteriskField">* </span>
        </label>
        <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addContactModal">Lisa kontakt</button>
        <div class="col-sm-9">
            <select id="contacts" name="contacts" multiple="multiple">
options added here by javascript
            </select>
        </div>
    </div>

    <div class="form-group">
        <div class="col-sm-9 col-sm-offset-3">
            <button class="btn btn-primary " name="submit" type="submit" th:text="#{save}"> Salvesta</button>
        </div>
    </div>
</form>

为什么message.getContacts值为null?名称为联系人的请求参数已被删除。

addMessage.html代码部分获取联系人参数值

<select id="contacts" name="contacts" multiple="multiple">
    <option value="2">test@mail.ee</option>
    <option value="3">mail@mail.ee</option>
    <option value="4">isik@mail.ee</option>
</select>

javascript生成代码的示例

array_unique()

0 个答案:

没有答案