how to display the checked values in jsp page to a servlet
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");
精彩评论