这是 index.jsp 页面:
<form method="post">
<select name="channel">
<option>Star Movie</option>
<option>HBO</option>
...
//More television channel option
</select>
<select name="channel">
<option>Star Movie</option>
<option>HBO</option>
...
//More television channel option
</select>
...
//More select input added dynamic by user
<button class="btn-add" >Add channel</button>
<input type="submit" value="Submit"/>
</form>
这是我的控制器
@RequestMapping(value = "/channelReview", method = RequestMethod.POST)
ModelAndView actionChannelReview(@RequestParam("channel") String[] channelLst){
...
//Do something else
}
这里的问题是为什么 channelLst 只有 1 个元素并且它总是表单上的最后一个值,无论有多少用户在表单上添加。