开发者

requesting parameters from jsp

I have some problems with taking a parameters from jsp page, when method POST occurs.

My JSP page looks like this:

....
<table border="1">
<tr>
    <th>name</th>
    <th>check</th>
</tr>
    <c:forEach items="${things}" var="pair">
    <tr>
        <td>${things.name}</td>
        <td><INPUT TYPE="CHECKBOX" NAME=items VALUE=${things.id} ></td>
    </tr>
    </c:forEach>
</table>

<form method="post">       
     <input type="submit" value="Check all" />
</form>

So, I want to take all checked "things" in table. In controller class I something like this (written in Spring):

....
@RequestMapping(method = RequestMethod.POST)
public String sumbitForm(@RequestParam("items") String[] items){
    if(items!= null){
        for(String item: items){
            ....
        }
    }
    return "redirect:myPage";
}

But my app don't want to work with such Reque开发者_开发知识库sParam. It doesn't put the values of items parameter to it. (this method I took here http://www.go4expert.com/forums/showthread.php?t=4542)

Also I tried using @ModelAttribute instead of @RequesParam. When I'm using it, my app don't give a errors, but it also couldn't correctly put the "items" to this parameter.

Any ideas?

P.S. May be you know more better method of taking list of parameters from JSP page for using their values (like taking checked items)?


Your table is outside of the <form></form> so when submitting, it doesnt send anything.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜