开发者

how to display the checked values in jsp page to a servlet

开发者 https://www.devze.com 2023-02-20 13:03 出处:网络
I am writing a application which involves a dynamic tablein jsp with check boxes at each row. once i check in the check boxes at the rows, the selected values should be displayed in the next page as a

I am writing a application which involves a dynamic table in jsp with check boxes at each row. once i check in the check boxes at the rows, the selected values should be displayed in the next page as a servvlet and i should send the servlet to the server or DB. Can anyone pls help me in this regard. Thanks in adv开发者_运维知识库ance.


In your servlet you can obtain the selected check boxes using

String[] values = request.getParameterValues("checkboxGroup");

Your input types could be something like this:

<input type="checkbox" name="checkboxGroup" value="1" />
<input type="checkbox" name="checkboxGroup" value="2" />
<input type="checkbox" name="checkboxGroup" value="3" />


Populate Table in jsp to show checkbox with each row

HTML should be following.

<input TYPE=checkbox name="teamName" VALUE="India"> India

Now POST it to some servlet and there use following code to retrieve selected checkboxes's value

 String team[] = request.getParameterValues("teamName");
0

精彩评论

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