Submitting Check Boxes
//File: index.html <HTML> <HEAD> <TITLE>Submitting Check Boxes</TITLE> </HEAD> <BODY> <H1>Submitting Check Boxes</H1> <FORM ACTION="formAction.jsp" METHOD="post"> <INPUT TYPE="CHECKBOX" NAME="check1" VALUE="check1" CHECKED> Checkbox 1 <BR> <INPUT TYPE="CHECKBOX" NAME="check2" VALUE="check2"> Checkbox 2 <BR> <INPUT TYPE="CHECKBOX" NAME="check3" VALUE="check3"> Checkbox 3 <BR> <INPUT TYPE="SUBMIT" VALUE="Submit"> </FORM> </BODY> </HTML> //File: formAction.jsp <HTML> <HEAD> <TITLE>Reading Checkboxes</TITLE> </HEAD> <BODY> <H1>Reading Checkboxes</H1> <% if(request.getParameter("check1") != null) { out.println("Checkbox 1 was checked.<BR>"); } else { out.println("Checkbox 1 was not checked.<BR>"); } if(request.getParameter("check2") != null) { out.println("Checkbox 2 was checked.<BR>"); } else { out.println("Checkbox 2 was not checked.<BR>"); } if(request.getParameter("check3") != null) { out.println("Checkbox 3 was checked.<BR>"); } else { out.println("Checkbox 3 was not checked.<BR>"); } %> </BODY> </HTML>