0

これは 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 つの要素しか持たず、ユーザーがフォームに追加した数に関係なく、常にフォームの最後の値である理由です。

4

2 に答える 2