在 JSP 中:
在对应的 ActionForm 中:
要让该 checkbox 选中,则调用:
要判断该 checkbox 是否被选中,则调用:
<html:checkbox property="checkbox" value="on" />
在对应的 ActionForm 中:
public String getCheckbox() {
return checkbox;
}
public void setCheckbox(String s) {
if (s == null) {
checkbox = "";
} else {
checkbox = s;
}
}
return checkbox;
}
public void setCheckbox(String s) {
if (s == null) {
checkbox = "";
} else {
checkbox = s;
}
}
要让该 checkbox 选中,则调用:
xxx.setCheckbox("on");
要判断该 checkbox 是否被选中,则调用:
if (xxx.getCheckbox().equals("")) {
// checkbox 没有被选中
} else {
// checkbox 已被选中
}
// checkbox 没有被选中
} else {
// checkbox 已被选中
}
浙公网安备 33010602011771号