<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String encode = "UTF-8";
request.setCharacterEncoding(encode);
String sSubmit000 = request.getParameter("Submit000");
String[] a1sCheckName = { "Check000", "Check001", "Check002" };
String[] a1sCheckHTML = new String[a1sCheckName.length];
String[] a1sCheck = new String[a1sCheckName.length];
for (int i = 0; i < a1sCheckName.length; i++) {
a1sCheck[i] = "";
}
// if(sSubmit000!=null&&!"".equals(sSubmit000))
if (sSubmit000 != null) {
System.out.printf("sSubmit000: %s%n", sSubmit000);
System.out.printf("a1sCheck.length: %d%n", a1sCheck.length);
for (int i = 0; i < a1sCheckName.length; i++) {
String p = request.getParameter(a1sCheckName[i]);
a1sCheckHTML[i] = "";
if (p != null && !"".equals(p)) {
a1sCheckHTML[i] = "";
} else {
a1sCheckHTML[i] = "checked";
}
System.out.print(a1sCheckHTML[i] + ",");
}
System.out.println();
}
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<form method="post">
<!-- method="get"だとパラメータ・サイズに厳しい制限があるので要注意 -->
<input type="checkbox" name="Check000" <%=a1sCheckHTML[0]%>>
<input type="checkbox" name="Check001" <%=a1sCheckHTML[1]%>>
<input type="checkbox" name="Check002" <%=a1sCheckHTML[2]%>>
<br>
<input type="submit" value="Submit" name="Submit000">
<br>
</form>
</body>
</html>