方法1.给所有的checkbox取同一个名字,而value值不同,用request的getParameterValues();方法把所有被选中的checkbox的值传到一个数组中,从而确定哪些checkbox被选中了.
<%@ page language="Java" contentType="text/html" %>
<%@ page import="com.ora.jsp.util.*" %>
<html>
<body bgcolor="white">
<form action="checkbox.jsp">
<input type="checkbox" name="fruits" value="Apple">Apple<br>
<input type="checkbox" name="fruits" value="Banana">Banana<br>
<input type="checkbox" name="fruits" value="Orange">Orange<br>
<input type="submit" value="Enter">
</form></