1
<form name = "form1" method = "post" action = "doit.jsp">
2
//所有的表單程序必須寫在form表單里
3
<input type = "checkbox" name = "color" value = "color"紅色>
4
<input type = "checkbox" name = "color" value = "green"綠色>
5
<input type = "checkbox" name = "color" value = "yellow"黃色>
6
</form>
7
8
9
10
doit.jsp
11
<%@ page contentType = "text/html";Charset = GBK; %>
12
<%
13
String color[] = request.getParameterValues("color");
14
for(int i = 0;i<=color.length-1;i++){
15
out.println("color"+color[i]+" ");
16
}
17
%>
18
//request.getParameterValues("color")需要用數(shù)組來接收

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

沒有所謂的命運(yùn),只有不同的選擇!