1

i have many select boxes on the page, which are genereted by js.

<select class='form-control mySelector' name='crossStageForm.teamIds[i]'>"
    <option value='${null}'>choose team</option>
    <c:forEach items='${crossStageForm.teamTOs}' var='teamTO'>
        <option value='${teamTO.id}' label='${teamTO.title}'/>
    </c:forEach>
</select>

i need to save ids into array of Long values of spring form. this is my form with array

public class CrossStageForm {
    //other fields
    private Long[] teamIds;
    //getters and setters 
}

also i think maybe in js i should generate also constructions for saving i value and then using it as index for array, but anyway i'm not sure if i'm using right way for saving values from select to array . So the question is about many select boxes and saving it's values to array

4

1 回答 1

0

好的,我发现我的错误:选择在表单上,​​所以在选择“名称”属性中我不应该写表单名称,只写“teamIds”并且没有索引,现在它工作正常

于 2014-04-03T13:15:12.740 回答