How to get a Servlet form check box is selected value

Category: Java EE
 
wangshiliang04
2011-12-20 12:56:17

Sponsored Links
Want to know the user in the form of those selected content ... Servlet how can we get?

Sponsored Links

a123570023
2011-12-20 01:06:47
<form action="/ursevlet">

<input type="checkbox" name="fruit" value ="apple"> Apple <br>
<input type = "checkbox" name = "fruit" value = "orange"> orange <br>
<input type = "checkbox" name = "fruit" value = "mango"> Mango <br>

</form>

obtained through the following check boxes selected value
String [] values ​​= request.getParameterValues ​​(" ; fruit ");
if (values! = null && values.length> 0) {
; for (int i = 0; i <values.length; i + +)
out.println ( values ​​[i]);
}
Lebonjou
2011-12-20 01:18:21
String [] values ​​= request.getParameterValues ​​("fruit");

this is to get all the selected
deason6975
2011-12-20 01:27:15
What I want is to be selection of. . .
not been selected to do it. . ?
to how to do oh?
lyt9982003
2011-12-20 01:44:03
Thank you, ah. . . Oh
Domain and server ip had changed since 8/23/2013. Suspend the user registration and posts for program maintenance.